ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 24 Mar 2009 18:08:43 -0700

On Mar 24, 2009, at 3:13 PM, jmayer@xxxxxxxxxxxxx quoted Andreas Schuler:

weiter hab ich festgestellt das das b-field nicht richtig dargestellt wird .
Entweder ist g_snprintf broken , oder wir sind beide zu unfähig die
funktion zu benutzen .
Der string wird aus 16x %.2x + leerzeichen zusammengesetzt , was nach
meinen berechnungen eine höchstlänge von 144 zeichen + nullbyte ergibt . deshalb hab ich die stringvariable auf 145 hochgesetzt und benutze wieder
sprintf . hier der patch dazu .

or, as translate.google.com says:

I further noted that the b-field is not displayed correctly.
Either g_snprintf broken, or we are unable to both the
function to use.
The string is made from 16x% .2 x + spaces together what
My calculations of a maximum length of 144 characters + null byte follows.
therefore I have the string variable to 145 high and use again
sprintf. here the patch to do so.

So what was g_snprintf() doing that was wrong? (The second argument was correct in the calls - the total length of the buffer should be passed, as that length includes the terminating null byte.) And what version of GLib was he using?