Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-dev: [Wireshark-dev] [PATCH] hex_str_to_bytes and NULL tests

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: Sebastien Tandel <sebastien@xxxxxxxxx>
Date: Sun, 04 Feb 2007 13:38:28 +0100

Hi,


   Steve has modified a while ago hex_str_to_bytes to handle Cisco MAC
format (xxxx.xxxx.xxxx). It did not test the nullity of the third and
fourth byte (*r, *s) which is however done for the second byte. The test
on the second byte is done as well in the following conditional tests.
If this test is not mandatory thanks to the return value of isxdigit (at
least on GNU/Linux and guess it should be the same on any platform), it
would be better to follow the same logic in all tests cases for the
comprehension of everyone (... which /could/ even, with luck, be turned
in a faster code).
Here is a light patch to follow the logic of the conditional tests done
in the function.



Regards,
Sebastien Tandel

Index: epan/strutil.c
===================================================================
--- epan/strutil.c	(révision 20702)
+++ epan/strutil.c	(copie de travail)
@@ -443,7 +443,8 @@
 		r = p+2;
 		s = p+3;
 
-		if (*q && isxdigit(*p) && isxdigit(*q) &&
+		if (*q && *r && *s 
+		    && isxdigit(*p) && isxdigit(*q) &&
 		    isxdigit(*r) && isxdigit(*s)) {
 			four_digits_first_half[0] = *p;
 			four_digits_first_half[1] = *q;
  • Follow-Ups:
    • Re: [Wireshark-dev] [PATCH] hex_str_to_bytes and NULL tests
      • From: Stephen Fisher
  • Prev by Date: Re: [Wireshark-dev] U3 questions/remarks
  • Next by Date: Re: [Wireshark-dev] IS-41 ANSI-MAP
  • Previous by thread: Re: [Wireshark-dev] [PATCH] Fixup for a segfault with gtk1.2
  • Next by thread: Re: [Wireshark-dev] [PATCH] hex_str_to_bytes and NULL tests
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation