summaryrefslogtreecommitdiff
path: root/epan/crypt
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-11-27 18:52:51 +0000
committerGuy Harris <guy@alum.mit.edu>2007-11-27 18:52:51 +0000
commit9c89cdaaa3eccfe74d4e17705f38508c640b5047 (patch)
tree593646c7e1eb44302243659672c5fc691f0d4272 /epan/crypt
parenta189f34b84345d6851a489c484c01c1bf21f56d1 (diff)
downloadwireshark-9c89cdaaa3eccfe74d4e17705f38508c640b5047.tar.gz
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. svn path=/trunk/; revision=23623
Diffstat (limited to 'epan/crypt')
-rw-r--r--epan/crypt/airpdcap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c
index 87297056e3..04f1a9ff35 100644
--- a/epan/crypt/airpdcap.c
+++ b/epan/crypt/airpdcap.c
@@ -49,6 +49,10 @@
#include "wep-wpadefs.h"
+#ifdef NEED_G_ASCII_STRCASECMP_H
+#include "g_ascii_strcasecmp.h"
+#endif
+
/****************************************************************************/
/****************************************************************************/
@@ -1353,7 +1357,7 @@ parse_key_string(gchar* input_string)
/* First, check for a WEP string */
/* XXX - This duplicates code in packet-ieee80211.c */
- if (g_strncasecmp(input_string, STRING_KEY_TYPE_WEP ":", 4) == 0) {
+ if (g_ascii_strncasecmp(input_string, STRING_KEY_TYPE_WEP ":", 4) == 0) {
first_nibble += 4;
}
@@ -1407,7 +1411,7 @@ parse_key_string(gchar* input_string)
ssid = g_strdup(tokens[2]);
}
- if (g_strcasecmp(type,STRING_KEY_TYPE_WPA_PSK) == 0) /* WPA key */
+ if (g_ascii_strcasecmp(type,STRING_KEY_TYPE_WPA_PSK) == 0) /* WPA key */
{
/* Create a new string */
key_string = g_string_new(key);
@@ -1446,7 +1450,7 @@ parse_key_string(gchar* input_string)
g_strfreev(tokens);
return dk;
}
- else if(g_strcasecmp(type,STRING_KEY_TYPE_WPA_PWD) == 0) /* WPA key *//* If the number of tokens is more than three, we accept the string... if the first three tokens are correct... */
+ else if(g_ascii_strcasecmp(type,STRING_KEY_TYPE_WPA_PWD) == 0) /* WPA key *//* If the number of tokens is more than three, we accept the string... if the first three tokens are correct... */
{
/* Create a new string */
key_string = g_string_new(key);