Patch from Chris Jepeway <jepeway@blasted-heath.com> to not dereference

misaligned pointers in the EtherTalk DDP printer on platforms that can't
handle misaligned addresses.
This commit is contained in:
guy 2001-07-18 09:19:47 +00:00
parent b09028fb59
commit 432b66a272
2 changed files with 17 additions and 1 deletions

View File

@ -19,6 +19,7 @@ Additional people who have contributed patches:
Ben Smithurst <ben@scientia.demon.co.uk>
Charlie Lenahan <clenahan@fortresstech.com>
Chris G. Demetriou <cgd@netbsd.org>
Chris Jepeway <jepeway@blasted-heath.com>
Craig Rodrigues <rodrigc@mediaone.net>
Daniel Hagerty <hag@ai.mit.edu>
Francisco Matias Cuenca-Acuna <mcuenca@george.rutgers.edu>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.67 2001-07-05 18:54:14 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.68 2001-07-18 09:19:47 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -186,6 +186,21 @@ atalk_print(register const u_char *bp, u_int length)
ddpskt_string(dp->dstSkt));
bp += ddpSize;
length -= ddpSize;
#ifdef LBL_ALIGN
if ((long)bp & 3) {
static u_char *abuf = NULL;
if (abuf == NULL) {
abuf = (u_char *)malloc(snaplen);
if (abuf == NULL)
error("atalk_print: malloc");
}
memcpy((char *)abuf, (char *)bp, min(length, snaplen));
snapend += abuf - (u_char *)bp;
packetp = abuf;
bp = abuf;
}
#endif
ddp_print(bp, length, dp->type, snet, dp->srcNode, dp->srcSkt);
}