]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Patch from Chris Jepeway <[email protected]> to not dereference
authorguy <guy>
Wed, 18 Jul 2001 09:19:47 +0000 (09:19 +0000)
committerguy <guy>
Wed, 18 Jul 2001 09:19:47 +0000 (09:19 +0000)
misaligned pointers in the EtherTalk DDP printer on platforms that can't
handle misaligned addresses.

CREDITS
print-atalk.c

diff --git a/CREDITS b/CREDITS
index f7df588d801ab889241fef8b2ecd4d4e261b72b1..cdd30b8cfc4d8d504c176f3f546a7a178a4aea4b 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -19,6 +19,7 @@ Additional people who have contributed patches:
        Ben Smithurst                   <[email protected]>
        Charlie Lenahan                 <[email protected]>
        Chris G. Demetriou              <[email protected]>
+       Chris Jepeway                   <[email protected]>
        Craig Rodrigues                 <[email protected]>
        Daniel Hagerty                  <[email protected]>
        Francisco Matias Cuenca-Acuna   <[email protected]>
index 30ae8b4edd72876d097bb2848ed66c263d57356d..3cc5550056ee6767e028ffd42f7217b6861d9775 100644 (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);
 }