From: itojun Date: Thu, 15 Nov 2001 07:43:31 +0000 (+0000) Subject: die if malloc fails in #ifdef LBL_ALIGN. X-Git-Tag: tcpdump-3.7.1~34 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/fd7fd3af668b7933e3ece7a5bc38f703998e0000?ds=inline die if malloc fails in #ifdef LBL_ALIGN. XXX LBL_ALIGN path is not really torture-tested, and at this moment it can affect field printing badly (like TCP). --- diff --git a/print-ip6.c b/print-ip6.c index 68d7d6e2..a6acce81 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -21,7 +21,7 @@ #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 @@ -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 (abuf == NULL) + if (abuf == NULL) { abuf = malloc(snaplen); + if (abuf == NULL) + error("ip6_print: malloc"); + } memcpy(abuf, ip6, min(length, snaplen)); snapend += abuf - (u_char *)ip6; packetp = abuf;