]> The Tcpdump Group git mirrors - tcpdump/commitdiff
return-checks: Added a return check for malloc and for strsep 710/head
authoragnosticdev <[email protected]>
Tue, 9 Oct 2018 02:18:52 +0000 (21:18 -0500)
committeragnosticdev <[email protected]>
Tue, 9 Oct 2018 02:18:52 +0000 (21:18 -0500)
print-esp.c
tcpdump.c

index 774ec72ca842a365474b7ee34b3860770ace5836..e5a490f552fb416a50e316ecd19bc42ec5b407d5 100644 (file)
@@ -424,7 +424,7 @@ espprint_decode_encalgo(netdissect_options *ndo,
 USES_APPLE_RST
 
 /*
- * for the moment, ignore the auth algorith, just hard code the authenticator
+ * for the moment, ignore the auth algorithm, just hard code the authenticator
  * length. Need to research how openssl looks up HMAC stuff.
  */
 static int
@@ -577,6 +577,10 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                uint32_t spino;
 
                spistr = strsep(&spikey, "@");
+               if (spistr == NULL) {
+                       (*ndo->ndo_warning)(ndo, "print_esp: failed to find the @ token");
+                       return;
+               }
 
                spino = strtoul(spistr, &foo, 0);
                if (spistr == foo || !spikey) {
index 7fcace9c89aa608798b55a16bd224d3c749579a2..3b4d84f9ae85e6ad7ebc59d108e4971d5c63be0a 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1156,6 +1156,9 @@ _U_
                 */
                endp++; /* Include the trailing / in the URL; pcap_findalldevs_ex() requires it */
                host_url = malloc(endp - url + 1);
+               if (host_url == NULL && (endp - url + 1) > 0)
+                       error("Invalid allocation for host");
+
                memcpy(host_url, url, endp - url);
                host_url[endp - url] = '\0';
                status = pcap_findalldevs_ex(host_url, NULL, &devlist, ebuf);