Ethereal-dev: Re: [Ethereal-dev] Ethereal 0.99.0 epan/strutil.c - utf_8to16 bug

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, 27 Apr 2006 09:43:02 +0200
Joe Hagen wrote:
I believe the utf_8to16 function in epan/strutil.c
has a bug.  I've experienced access violations
with version 0.99.0 when starting a capture that
point to this function.

I performed tests using Windows XP SP2 and
used the gflags program to enable page heap
checking on ethereal.exe.

The fault actually occurs in the Win32 function
MultiByteToWideChar, but occurs because this
code:

  utf16buf[idx] = g_realloc(utf16buf[idx], utf16buf_len[idx]);

doesn't account for the sizeof(wchar_t) when allocating
memory, resulting in an access violation.  The buffer
passed to MultiByteToWideChar is too small.

The code in the utf_8to16() function seems to be looking ok at first sight.

I would guess the problem is caused by an invalid utf8str string given to that function. Could you provide a call stack and an explanation what you've done to trigger that bug?

As this is obviously a bug, could you add a bug report to http://bugs.ethereal.com/bugzilla/ ?

Regards, ULFL