diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-11-27 18:52:51 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-11-27 18:52:51 +0000 |
commit | 9c89cdaaa3eccfe74d4e17705f38508c640b5047 (patch) | |
tree | 593646c7e1eb44302243659672c5fc691f0d4272 /epan/req_resp_hdrs.c | |
parent | a189f34b84345d6851a489c484c01c1bf21f56d1 (diff) | |
download | wireshark-9c89cdaaa3eccfe74d4e17705f38508c640b5047.tar.gz wireshark-9c89cdaaa3eccfe74d4e17705f38508c640b5047.tar.bz2 wireshark-9c89cdaaa3eccfe74d4e17705f38508c640b5047.zip |
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/req_resp_hdrs.c')
-rw-r--r-- | epan/req_resp_hdrs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index e1267a37e8..99bee6705d 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -34,6 +34,10 @@ #include <epan/req_resp_hdrs.h> +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* * Optionally do reassembly of the request/response line, headers, and body. */ @@ -171,7 +175,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, while(*header_val==' '){ header_val++; } - if(!strncasecmp(header_val, "Keep-Alive", 10)){ + if(!g_ascii_strncasecmp(header_val, "Keep-Alive", 10)){ keepalive_found = TRUE; } } @@ -196,7 +200,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, (*p == ' ' || *p == '\t')) p++; if (p <= header_val + len) { - if (strncasecmp(p, "chunked", 7) + if (g_ascii_strncasecmp(p, "chunked", 7) == 0) { /* * Don't bother looking |