Wireshark mailing list archives

Re: Sprintf weirdness


From: Ian Schorr <ian.schorr () gmail com>
Date: Wed, 2 Jun 2010 15:15:40 +1000

On Wed, Jun 2, 2010 at 3:03 PM, Jaap Keuter <jaap.keuter () xs4all nl> wrote:
Hi,

With "%lu" you tell sprintf to expect a 32 bit value on the stack,
while in fact you put 64 bit sized value 0 there. That reads like two
times 32 bit sized value 0, hence the results you see.

The rest is left as an exercise to the reader ;)

Thanks,
Jaap

Thanks, Jaap.

It looks like %llu resolves the problem, at least on this platform.  I
thought it'd be something like that, though it looked like sprintf was
actually writing the same value twice, so it didn't seem like a sizing
issue (I figured I'd see the values from the upper and lower 32-bits.
But now that I think about it more, I think it's starting to make
sense.
___________________________________________________________________________
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: