diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-27 18:52:51 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-27 18:52:51 +0000 |
commit | 4d005106f956ff792cd46cb90050f5ebf13f133e (patch) | |
tree | 593646c7e1eb44302243659672c5fc691f0d4272 /epan/dissectors/packet-wsp.c | |
parent | 3a9435a5c8f4833aeebc0a120f4fd0657e25db3e (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 'epan/dissectors/packet-wsp.c')
-rw-r--r-- | epan/dissectors/packet-wsp.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index e5a6f410c0..76f1b538af 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -59,6 +59,10 @@ #include "packet-wap.h" #include "packet-wsp.h" +#ifdef NEED_G_ASCII_STRCASECMP_H +#include "g_ascii_strcasecmp.h" +#endif + /* General-purpose debug logger. * Requires double parentheses because of variable arguments of printf(). * @@ -1795,7 +1799,7 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) } else { /* Old-style X-WAP-TOD uses a non-textual value * after a textual header. */ - if (strcasecmp(hdr_str, "x-wap.tod") == 0) { + if (g_ascii_strcasecmp(hdr_str, "x-wap.tod") == 0) { get_delta_seconds_value(val, tvb, val_start, val_len, ok); if (ok) { if (val == 0) { @@ -5397,7 +5401,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Content type is a string. */ /* - if (strcasecmp(contentTypeStr, "application/vnd.wap.sia") == 0) { + if (g_ascii_strcasecmp(contentTypeStr, "application/vnd.wap.sia") == 0) { dissect_sir(tree, tmp_tvb); } else */ @@ -5586,25 +5590,25 @@ add_capabilities (proto_tree *tree, tvbuff_t *tvb, guint8 pdu_type) return; } /* 2. Look up the string capability name */ - if (strcasecmp(capaName, "client-sdu-size") == 0) { + if (g_ascii_strcasecmp(capaName, "client-sdu-size") == 0) { peek = WSP_CAPA_CLIENT_SDU_SIZE; - } else if (strcasecmp(capaName, "server-sdu-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "server-sdu-size") == 0) { peek = WSP_CAPA_SERVER_SDU_SIZE; - } else if (strcasecmp(capaName, "protocol options") == 0) { + } else if (g_ascii_strcasecmp(capaName, "protocol options") == 0) { peek = WSP_CAPA_PROTOCOL_OPTIONS; - } else if (strcasecmp(capaName, "method-mor") == 0) { + } else if (g_ascii_strcasecmp(capaName, "method-mor") == 0) { peek = WSP_CAPA_METHOD_MOR; - } else if (strcasecmp(capaName, "push-mor") == 0) { + } else if (g_ascii_strcasecmp(capaName, "push-mor") == 0) { peek = WSP_CAPA_PUSH_MOR; - } else if (strcasecmp(capaName, "extended methods") == 0) { + } else if (g_ascii_strcasecmp(capaName, "extended methods") == 0) { peek = WSP_CAPA_EXTENDED_METHODS; - } else if (strcasecmp(capaName, "header code pages") == 0) { + } else if (g_ascii_strcasecmp(capaName, "header code pages") == 0) { peek = WSP_CAPA_HEADER_CODE_PAGES; - } else if (strcasecmp(capaName, "aliases") == 0) { + } else if (g_ascii_strcasecmp(capaName, "aliases") == 0) { peek = WSP_CAPA_ALIASES; - } else if (strcasecmp(capaName, "client-message-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "client-message-size") == 0) { peek = WSP_CAPA_CLIENT_MESSAGE_SIZE; - } else if (strcasecmp(capaName, "server-message-size") == 0) { + } else if (g_ascii_strcasecmp(capaName, "server-message-size") == 0) { peek = WSP_CAPA_SERVER_MESSAGE_SIZE; } else { DebugLog(("add_capabilities(): unknown capability '%s' at offset %u\n", @@ -5855,7 +5859,7 @@ add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType, } if ( (contentTypeStr == NULL && contentType == 0x12) - || (contentTypeStr && (strcasecmp(contentTypeStr, + || (contentTypeStr && (g_ascii_strcasecmp(contentTypeStr, "application/x-www-form-urlencoded") == 0)) ) { if (tree) { |