Ethereal-dev: [Ethereal-dev] serious bug: g_snprintf also uses "UNIX style" 64 bit formatting

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Thu, 22 Sep 2005 03:32:10 +0200
Hi List!

printf like UNIX style format string for 64 bit integers is e.g. %lld, while the Win32 one is %I64d.

So we define PRId64 in config.h which defines it for the platform, so the source code can simply use it.

So far, so good.


Unfortunately, on Win32 the g_snprintf function don't use the Win32 functions, but using it's own implementation in glib\gnulib\vasnprintf.

And the GLib implementation uses the %lld format strings just like the UNIX string.


This way, there are currently *several* places using this format string wrong now, which unfortunately *will crash* :-(

To make things even worse, we have functions which return the format string, so special care must be taken to use theses functions.


We could:

- replace *all* instances of printf like functions with the g_ functions (my favourite) - hard code the UNIX like format string at all places where g_snprintf is used
- ... ?!?

Obviously these kind of bugs are not found by the buildbot on FreeBSD, I've found them using private fuzz tests on Win32.

Any other ideas how we should fix this?

Regards, ULFL