]> The Tcpdump Group git mirrors - tcpdump/commitdiff
In reviewing addrtoname.c, I found a minor issue with a call to
authorBill Parker <[email protected]>
Mon, 3 Sep 2012 21:21:32 +0000 (17:21 -0400)
committerMichael Richardson <[email protected]>
Mon, 3 Sep 2012 21:23:14 +0000 (17:23 -0400)
malloc() failing to check it's return value in file 'addrtoname.c' in
function 'LookupBytestring'.  Here is the resulting patch below :)

addrtoname.c

index d77f27b0ac4fd999e29cf48fa8f49df82270582a..350cd5e5d30a0e63fce877ff84d2f9d5cdd1d8bb 100644 (file)
@@ -381,6 +381,9 @@ lookup_bytestring(register const u_char *bs, const unsigned int nlen)
        tp->e_addr2 = k;
 
        tp->e_bs = (u_char *) calloc(1, nlen + 1);
+       if (tp->e_nxt == NULL)
+               error("lookup_bytestring: calloc");
+
        memcpy(tp->e_bs, bs, nlen);
        tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
        if (tp->e_nxt == NULL)