Wireshark-dev: Re: [Wireshark-dev] Bug 976
From: "Martin Mathieson" <[email protected]>
Date: Fri, 21 Jul 2006 20:57:18 +0100
From: "Guy Harris" <[email protected]>
> On Jul 21, 2006, at 2:28 AM, Martin Mathieson wrote:
> > I hadn't realised that gerald  fixed this (r18600) by making the
> > format
> > string "%s". And of course every other call to proto_tree_add_text()
> > I've seen uses a literal format string.
> I don't know if any version of GCC has an option to warn about non-
> constant format strings; they can be useful (and, in fact, we use
> them), but it's useful to have some human check them to make sure
> they're really format strings rather than arbitrary strings.

I think I wouldn't have created this bug in the first place if the function
was instead called proto_tree_add_text_format().  I didn't realise the last
arg was a format string - I'm used to those function names having the
_format suffix.

The other (slightly) strange thing is that when the format string (which is
supposed to be a const char*) was created by tvb_format_text() (which
returns a char*), I don't think my version of gcc showed a warning.