summaryrefslogtreecommitdiff
path: root/tcpdump.c
diff options
context:
space:
mode:
authoragnosticdev <agnosticdev@gmail.com>2018-10-08 21:18:52 -0500
committeragnosticdev <agnosticdev@gmail.com>2018-10-08 21:18:52 -0500
commit50301a252f4debdbaf1f66f97999a1807ca0e488 (patch)
tree51ef16dea4c5e2d82fcec2c206e35b20834bc578 /tcpdump.c
parent51eefc7c84f6791de120c3944387cff1c16a84de (diff)
downloadtcpdump-50301a252f4debdbaf1f66f97999a1807ca0e488.tar.gz
return-checks: Added a return check for malloc and for strsep
Diffstat (limited to 'tcpdump.c')
-rw-r--r--tcpdump.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tcpdump.c b/tcpdump.c
index 7fcace9c..3b4d84f9 100644
--- 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);