aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-imap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-19 23:14:50 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-20 06:15:19 +0000
commit80e6f6251e96dd7b8a9ab0fdbf63b03a73ef6692 (patch)
tree92d519b9b19cccba0d083a6ad20152352daa5924 /epan/dissectors/packet-imap.c
parent0b9eb9f4b71b6632cfb4b87bcdefdfa75eaf2dd0 (diff)
Get rid of calls to ctype.h functions.
They don't handle values outside the range -1 to 127, and their behavior is locale-dependent. Use g_ascii_isXXX() and g_ascii_toXXX() instead of isXXX() and toXXX(). If you're checking for printable ASCII, don't use isascii() and don't use iscntrl(), use g_ascii_isprint(). If you're checking for graphical ASCII, i.e. printable ASCII except for a space, use g_ascii_isgraph(). Use ws_xton() to convert a hex digit character to the corresponding numeric value. Change-Id: Id3039bc586fbf66d8736c2df248c790c0d7a2330 Reviewed-on: https://code.wireshark.org/review/4851 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-imap.c')
-rw-r--r--epan/dissectors/packet-imap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/epan/dissectors/packet-imap.c b/epan/dissectors/packet-imap.c
index eb09ef4167..596609cb9b 100644
--- a/epan/dissectors/packet-imap.c
+++ b/epan/dissectors/packet-imap.c
@@ -31,7 +31,6 @@
#include "packet-ssl.h"
#include <stdio.h>
-#include <ctype.h>
void proto_register_imap(void);
void proto_reg_handoff_imap(void);
@@ -162,7 +161,7 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tokenlen = get_token_len(line, line + linelen, &next_token);
if (tokenlen != 0) {
for (iter = 0; iter < tokenlen && iter < MAX_BUFFER-1; iter++) {
- tokenbuf[iter] = tolower(line[iter]);
+ tokenbuf[iter] = g_ascii_tolower(line[iter]);
}
if ( TRUE == is_request && strncmp(tokenbuf,"uid",tokenlen) == 0) {
proto_tree_add_item(reqresp_tree, hf_imap_request_uid, tvb, offset, tokenlen, ENC_ASCII|ENC_NA);
@@ -181,7 +180,7 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Save command string to do specialized processing.
*/
for (iter = 0; iter < uid_tokenlen && iter < MAX_BUFFER-1; iter++) {
- command_token[iter] = tolower(uid_line[iter]);
+ command_token[iter] = g_ascii_tolower(uid_line[iter]);
}
commandlen = uid_tokenlen;
@@ -201,7 +200,7 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Save command string to do specialized processing.
*/
for (iter = 0; iter < tokenlen && iter < 256; iter++) {
- command_token[iter] = tolower(line[iter]);
+ command_token[iter] = g_ascii_tolower(line[iter]);
}
commandlen = tokenlen;