Wireshark-bugs: [Wireshark-bugs] [Bug 3894] File-Open Display Filter is overwritten by Save-As F

Date: Wed, 13 Oct 2010 13:59:37 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3894

--- Comment #5 from Jeff Morriss <jeff.morriss.ws@xxxxxxxxx> 2010-10-13 13:59:36 PDT ---
(In reply to comment #3)
> Created an attachment (id=5291)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=5291) [details]
> Fix duplicate idx's.  Set display filter strings back to NULL after use.
> 
> This patch fixes a bug in wsutil/unicode-utils.c whereby the same idx variable
> was being used in 2 different arrays, which I believe is the root cause of this
> bug.

Ahh, the interaction with the unicode-utils probably explains it.

But this idx variable:

 wchar_t * utf_8to16(const char *utf8str) {
-  static wchar_t *utf16buf[3];
-  static int utf16buf_len[3];
-  static int idx;

is NOT the same as this one:

 gchar * utf_16to8(const wchar_t *utf16str) {
-  static gchar *utf8buf[3];
-  static int utf8buf_len[3];
-  static int idx;


(function-static variables are "global" in that they persist between calls to
the function but they are only accessible from within that function.)

Maybe just enlarging the array fixes it?

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.