Ethereal-dev: [Ethereal-dev] PATCH : packet_info.h

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: MEYER Laurent <laurent.meyer@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Feb 2003 17:00:09 +0100
    This patch report a bug on the ADDRESSES_EQUAL macro

When the address type is AT_NONE for the two addresses, there is
no need to compare the remaining fields.

When filling up packet address, some dissectors, if address type is
AT_NONE
don't fill the others fields. So there may have amything into these
fields.

Please find enclosed the patch which fix this bug.

Laurent MEYER


--- packet_info.h.orig	Fri Feb 28 16:50:27 2003
+++ packet_info.h	Fri Feb 28 16:45:29 2003
@@ -73,9 +73,10 @@
  * Given two addresses, return "true" if they're equal, "false" otherwise.
  */
 #define ADDRESSES_EQUAL(addr1, addr2) \
+        ((((addr1)->type == AT_NONE) && ((addr2)->type == AT_NONE))|| \
 	((addr1)->type == (addr2)->type && \
 	 (addr1)->len == (addr2)->len && \
-	 memcmp((addr1)->data, (addr2)->data, (addr1)->len) == 0)
+	 memcmp((addr1)->data, (addr2)->data, (addr1)->len) == 0))
 
 /*
  * Copy an address, allocating a new buffer for the address data.