aboutsummaryrefslogtreecommitdiffstats
path: root/capture-wpcap.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-11-27 18:52:51 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-11-27 18:52:51 +0000
commit4d005106f956ff792cd46cb90050f5ebf13f133e (patch)
tree593646c7e1eb44302243659672c5fc691f0d4272 /capture-wpcap.c
parent3a9435a5c8f4833aeebc0a120f4fd0657e25db3e (diff)
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
Diffstat (limited to 'capture-wpcap.c')
-rw-r--r--capture-wpcap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/capture-wpcap.c b/capture-wpcap.c
index 7b1ecb3429..f7667f2574 100644
--- a/capture-wpcap.c
+++ b/capture-wpcap.c
@@ -41,6 +41,10 @@
/* XXX - yes, I know, I should move cppmagic.h to a generic location. */
#include "tools/lemon/cppmagic.h"
+#ifdef NEED_G_ASCII_STRCASECMP_H
+#include "g_ascii_strcasecmp.h"
+#endif
+
#define MAX_WIN_IF_NAME_LEN 511
@@ -406,7 +410,7 @@ pcap_datalink_name_to_val(const char *name)
* We don't have it in WinPcap; do it ourselves.
*/
for (i = 0; dlt_choices[i].name != NULL; i++) {
- if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
+ if (g_ascii_strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
name) == 0)
return dlt_choices[i].dlt;
}