Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 23761: /trunk/epan/dissectors/ /trun

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 05 Dec 2007 02:49:00 -0800
Martin Mathieson wrote:

Does this mean that the %3s will copy 3 characters into the protocol name buffer followed by an extra NULL terminator?

That's how I read the man page:

$ man sscanf

	...


In addition to these flags, there may be an optional maximum field width, expressed as a decimal integer, between the % and the conversion. If no
     width is given, a default of ``infinity'' is used (with one exception,
below); otherwise at most this many bytes are scanned in processing the
     conversion.  In the case of the lc, ls and l[ conversions, the field
width specifies the maximum number of multibyte characters that will be
     scanned.  Before conversion begins, most conversions skip white space;
     this white space is not counted against the field width.

     The following conversions are available:

		...

s Matches a sequence of non-white-space characters; the next pointer
           must be a pointer to char, and the array must be large enough to
           accept all the sequence and the terminating NUL character.  The
           input string stops at white space or at the maximum field width,
           whichever occurs first.