Wireshark mailing list archives
Re: Passing NULL to %s format specifiers
From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Wed, 15 Aug 2012 14:14:16 -0400
Evan Huus wrote:
On Wed, Aug 15, 2012 at 10:15 AM, Jeff Morriss <jeff.morriss.ws () gmail com> wrote:Evan Huus wrote:On Linux and most other operating systems I know of, passing a NULL to a %s format specifier is safe. On Solaris, as it turns out, it isn't [1]. The case in the filed bug is fairly trivial to fix, but I'm wondering if this is something that should be added to the Code Style / Portability section of README.developer? Alternatively, since I have no idea how many of these bugs we may have to fix, perhaps we should be wrapping all format strings somehow? Hopefully someone with some Solaris experience (or even a Solaris test box) could weigh in, since I have neither.For the record we last discussed this a little over a year ago: http://www.wireshark.org/lists/wireshark-dev/201105/msg00202.html As for adding something to the doc: sure but I doubt it'll help much.I'm a fan of a macro like Jakub mentioned as part of the old conversation: http://www.wireshark.org/lists/wireshark-dev/201105/msg00205.html If we go that route, perhaps someone can add a bit to checkAPIs that complains if it finds %s in a format string without the macro?
That might be a bit tough: we'd have to parse the text string counting the % conversion specifiers and then find the corresponding argument and check it for the macro.
___________________________________________________________________________ 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:
- Passing NULL to %s format specifiers Evan Huus (Aug 14)
- Re: Passing NULL to %s format specifiers Guy Harris (Aug 15)
- Re: Passing NULL to %s format specifiers Jeff Morriss (Aug 15)
- Re: Passing NULL to %s format specifiers mmann78 (Aug 15)
- Re: Passing NULL to %s format specifiers Jeff Morriss (Aug 15)
- Re: Passing NULL to %s format specifiers Evan Huus (Aug 15)
- Re: Passing NULL to %s format specifiers Jakub Zawadzki (Aug 15)
- Re: Passing NULL to %s format specifiers Guy Harris (Aug 15)
- Re: Passing NULL to %s format specifiers Jakub Zawadzki (Aug 16)
- Re: Passing NULL to %s format specifiers Guy Harris (Aug 16)
- Re: Passing NULL to %s format specifiers mmann78 (Aug 15)
- Re: Passing NULL to %s format specifiers Jeff Morriss (Aug 15)
- Re: Passing NULL to %s format specifiers Guy Harris (Aug 15)
- Re: Passing NULL to %s format specifiers Guy Harris (Aug 15)
- Re: Passing NULL to %s format specifiers Gerald Combs (Aug 16)
- Re: Passing NULL to %s format specifiers Evan Huus (Aug 16)