]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Sanity Checking added to addrtoname
authorBill Parker <[email protected]>
Tue, 4 Sep 2012 17:02:21 +0000 (10:02 -0700)
committerBill Parker <[email protected]>
Tue, 4 Sep 2012 17:02:21 +0000 (10:02 -0700)
Added return value checking for tp->e_bs against NULL to see if memory
was actually allocated :)

addrtoname.c

index d77f27b0ac4fd999e29cf48fa8f49df82270582a..c92870dc324a68c0a7a5cb6937ea7f5169b760ce 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_bs == 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)