]> The Tcpdump Group git mirrors - tcpdump/commitdiff
die if malloc fails in #ifdef LBL_ALIGN.
authoritojun <itojun>
Thu, 15 Nov 2001 07:43:31 +0000 (07:43 +0000)
committeritojun <itojun>
Thu, 15 Nov 2001 07:43:31 +0000 (07:43 +0000)
XXX LBL_ALIGN path is not really torture-tested, and at this moment it
can affect field printing badly (like TCP).

print-ip6.c

index 68d7d6e21c991328273900cc020771dfc85f50cd..a6acce81879cd1366f5dcf4b1a72ec4d934a8b20 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.18 2001-09-17 21:58:03 fenner Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.19 2001-11-15 07:43:31 itojun Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -72,8 +72,11 @@ ip6_print(register const u_char *bp, register u_int length)
        if ((u_long)ip6 & 15) {
                static u_char *abuf;
 
        if ((u_long)ip6 & 15) {
                static u_char *abuf;
 
-               if (abuf == NULL)
+               if (abuf == NULL) {
                        abuf = malloc(snaplen);
                        abuf = malloc(snaplen);
+                       if (abuf == NULL)
+                               error("ip6_print: malloc");
+               }
                memcpy(abuf, ip6, min(length, snaplen));
                snapend += abuf - (u_char *)ip6;
                packetp = abuf;
                memcpy(abuf, ip6, min(length, snaplen));
                snapend += abuf - (u_char *)ip6;
                packetp = abuf;