aboutsummaryrefslogtreecommitdiffstats
path: root/capture_loop.c
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 /capture_loop.c
parenta189f34b84345d6851a489c484c01c1bf21f56d1 (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. svn path=/trunk/; revision=23623
Diffstat (limited to 'capture_loop.c')
-rw-r--r--capture_loop.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/capture_loop.c b/capture_loop.c
index c147ee430f..4040d0e92b 100644
--- a/capture_loop.c
+++ b/capture_loop.c
@@ -88,6 +88,10 @@
#include "capture_loop.h"
+#ifdef NEED_G_ASCII_STRCASECMP_H
+#include "g_ascii_strcasecmp.h"
+#endif
+
/* E: capture_loop.c only (Wireshark/dumpcap) T: tshark only */
typedef struct _loop_data {
/* common */
@@ -341,7 +345,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
pncopy = g_strdup(pipename);
if ( (pos=strstr(pncopy, "\\\\")) == pncopy) {
pos = strchr(pncopy + 3, '\\');
- if (pos && g_strncasecmp(pos, PIPE_STR, strlen(PIPE_STR)) != 0)
+ if (pos && g_ascii_strncasecmp(pos, PIPE_STR, strlen(PIPE_STR)) != 0)
pos = NULL;
}