]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add checks for strdup() failure.
authorBill Parker <[email protected]>
Mon, 13 Jul 2015 19:59:46 +0000 (12:59 -0700)
committerGuy Harris <[email protected]>
Mon, 13 Jul 2015 19:59:46 +0000 (12:59 -0700)
print-atalk.c

index c5eb78006d24572a34c93255b21c3d69642599d8..09c0ff43b1e88d73722976c6af98de5826e7328c 100644 (file)
@@ -568,6 +568,8 @@ ataddr_string(netdissect_options *ndo,
                        tp->addr = i2;
                        tp->nxt = newhnamemem();
                        tp->name = strdup(nambuf);
+                       if (tp->name == NULL)
+                               error("ataddr_string: strdup(nambuf)");
                }
                fclose(fp);
        }
@@ -585,6 +587,8 @@ ataddr_string(netdissect_options *ndo,
                        (void)snprintf(nambuf, sizeof(nambuf), "%s.%d",
                            tp2->name, athost);
                        tp->name = strdup(nambuf);
+                       if (tp->name == NULL)
+                               error("ataddr_string: strdup(nambuf)");
                        return (tp->name);
                }
 
@@ -595,6 +599,8 @@ ataddr_string(netdissect_options *ndo,
        else
                (void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
        tp->name = strdup(nambuf);
+       if (tp->name == NULL)
+               error("ataddr_string: strdup(nambuf)");
 
        return (tp->name);
 }