aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sqloracle.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 /epan/dissectors/packet-sqloracle.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 'epan/dissectors/packet-sqloracle.c')
-rw-r--r--epan/dissectors/packet-sqloracle.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/epan/dissectors/packet-sqloracle.c b/epan/dissectors/packet-sqloracle.c
index d631f58e3e..f944302ce3 100644
--- a/epan/dissectors/packet-sqloracle.c
+++ b/epan/dissectors/packet-sqloracle.c
@@ -33,6 +33,11 @@
#include <string.h>
#include <epan/packet.h>
#include "packet-sqloracle.h"
+
+#ifdef NEED_G_ASCII_STRCASECMP_H
+#include "g_ascii_strcasecmp.h"
+#endif
+
#define SWAP_UI16(ui16) (((ui16)>>8 & 0xff) | ((ui16)<<8 & 0xff00))
/* option flag 1 */
@@ -325,7 +330,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
appMsg = (I8_P)m_pCurQuery;
#endif
- if (strncasecmp((I8_P)m_pCurQuery, "update", 6) == 0)
+ if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "update", 6) == 0)
{
m_numOfUpdate++;
#if 0
@@ -334,7 +339,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfUpdate++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "select", 6) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "select", 6) == 0)
{
m_numOfSelect++;
#if 0
@@ -343,7 +348,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfSelect++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "insert", 6) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "insert", 6) == 0)
{
m_numOfInsert++;
#if 0
@@ -352,7 +357,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfInsert++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "delete", 6) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "delete", 6) == 0)
{
m_numOfDelete++;
#if 0
@@ -361,7 +366,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfDelete++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "rollback", 8) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "rollback", 8) == 0)
{
m_numOfRollback++;
#if 0
@@ -370,7 +375,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfRollback++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "set", 3) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "set", 3) == 0)
{
m_numOfSet++;
#if 0
@@ -379,7 +384,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfSet++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "start", 5) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "start", 5) == 0)
{
m_numOfStart++;
#if 0
@@ -388,7 +393,7 @@ static void ParseSqlStatement(/*char *appMsg,*/ UI8_P pSqlData, UI16_T dataLen)
m_pServerNode->m_numOfStart++;
#endif
}
- else if (strncasecmp((I8_P)m_pCurQuery, "commit", 6) == 0)
+ else if (g_ascii_strncasecmp((I8_P)m_pCurQuery, "commit", 6) == 0)
{
m_numOfCommit++;
#if 0