Wireshark mailing list archives
Re: [Wireshark-commits] rev 37201: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-ncp2222.inc
From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Tue, 17 May 2011 12:45:08 -0400
Maynard, Chris wrote:
-----Original Message----- From: wireshark-commits-bounces () wireshark org [mailto:wireshark- commits-bounces () wireshark org] On Behalf Of morriss () wireshark org Sent: Tuesday, May 17, 2011 12:08 PM To: wireshark-commits () wireshark org Subject: [Wireshark-commits] rev 37201: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-ncp2222.inc http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=37201 User: morriss Date: 2011/05/17 09:07 AM Log: Avoid passing a NULL string pointer to format routines: some libc's (e.g., Solaris') will seg-fault on that. Directory: /trunk/epan/dissectors/ Changes Path Action +8 -4 packet-ncp2222.inc ModifiedWould it be better to use val_to_str() or val_to_str_const() in cases such as this?
Yes, either would probably work here: NCP2222's get_string() (which is used to generate the string most of the time) also returns ep_alloc'd memory (as val_to_str() may).
What about changing match_strval() to behave like val_to_str() does (i.e., make IT handle the NULL case), and then just have val_to_str() return match_strval()'s guaranteed non-NULL return value unconditionally? And also introduce a match_strval_const() counterpart for val_to_str_const().
The problem with changing match_strval() is there's a bunch of code like:
if (match_strval(type, a11_types) == NULL) return 0; /* not a known message type */
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: [Wireshark-commits] rev 37201: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-ncp2222.inc Maynard, Chris (May 17)
- Re: [Wireshark-commits] rev 37201: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-ncp2222.inc Guy Harris (May 17)
- Re: [Wireshark-commits] rev 37201: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-ncp2222.inc Jeff Morriss (May 17)