From 4d005106f956ff792cd46cb90050f5ebf13f133e Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 27 Nov 2007 18:52:51 +0000 Subject: strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our own versions if they're missing from GLib (as is the case with GLib 1.x). In the code to build the list of named fields for Diameter, don't use g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping in the hash function and use g_ascii_strcasecmp() in the compare function. We do this because there is no guarantee that toupper(), tolower(), and functions that use them will, for example, map between "I" and "i" in all locales; in Turkish locales, for example, there are, in both upper case and lower case, versions of "i" with and without a dot, and the upper-case version of "i" is "I"-with-a-dot and the lower-case version of "I" is "i"-without-a-dot. This causes strings that should match not to match. This finishes fixing bug 2010 - an earlier checkin prevented the crash (as there are other ways to produce the same crash, e.g. a bogus dictionary.xml file), but didn't fix the case-insensitive string matching. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23623 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-edonkey.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'epan/dissectors/packet-edonkey.c') diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c index e7b13be61d..0826364d89 100644 --- a/epan/dissectors/packet-edonkey.c +++ b/epan/dissectors/packet-edonkey.c @@ -45,6 +45,10 @@ #include "packet-edonkey.h" #include "packet-tcp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + static int proto_edonkey = -1; static int hf_edonkey_message = -1; @@ -529,7 +533,7 @@ static gint lookup_str_index(gchar* str, gint length, const value_string *vs) if (str == NULL) return -1; while (vs[i].strptr) { - if (strncasecmp(str, vs[i].strptr, length) == 0) + if (g_ascii_strncasecmp(str, vs[i].strptr, length) == 0) return i; i++; } -- cgit v1.2.3