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] Sprintf weirdness

From: Ian Schorr <ian.schorr@xxxxxxxxx>
Date: Wed, 2 Jun 2010 15:15:40 +1000
On Wed, Jun 2, 2010 at 3:03 PM, Jaap Keuter <jaap.keuter@xxxxxxxxx> 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.