diff options
author | Guy Harris <guy@alum.mit.edu> | 2008-09-03 19:14:52 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2008-09-03 19:14:52 +0000 |
commit | 9d1b5335ac1f48f57712f2937391c7a7b9ce6c19 (patch) | |
tree | a80eab1d12198196a9ae17670fe8f845c7204593 /wiretap | |
parent | 5dd544c914ac58d483bbb78bf7903de331fa2318 (diff) |
g_ascii_strdown() and g_ascii_strup(), unlike g_strdown() and g_strup(),
do *not* modify the string handed to them - they g_mallocate a new
string and return it.
Create routines that *do* ASCII-only case mapping in place, and use them
instead.
Clean up indentation.
svn path=/trunk/; revision=26131
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/iseries.c | 4 | ||||
-rw-r--r-- | wiretap/k12.c | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/wiretap/iseries.c b/wiretap/iseries.c index 4c31cf1724..f9ba4b303a 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -123,6 +123,8 @@ #include <ctype.h> #include <errno.h> +#include <wsutil/str_util.h> + #define ISERIES_HDR_MAGIC_STR " COMMUNICATIONS TRACE" #define ISERIES_HDR_MAGIC_LEN 21 #define ISERIES_PKT_MAGIC_STR "ETHV2" @@ -275,7 +277,7 @@ iseries_check_file_type (wtap * wth, int *err, int format) { iseries_UNICODE_to_ASCII ((guint8 *)buf, ISERIES_LINE_LENGTH); } - g_ascii_strup(buf,ISERIES_LINE_LENGTH); + ascii_strup_inplace(buf); num_items_scanned = sscanf (buf, " OBJECT PROTOCOL . . . . . . : %8s", protocol); diff --git a/wiretap/k12.c b/wiretap/k12.c index fcb92a0373..4088b9a896 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -32,12 +32,15 @@ #include <stdlib.h> #include <string.h> #include <errno.h> + #include "wtap-int.h" #include "wtap.h" #include "file_wrappers.h" #include "buffer.h" #include "k12.h" +#include <wsutil/str_util.h> + /*#define DEBUG_K12*/ #ifdef DEBUG_K12 #include <stdio.h> @@ -681,10 +684,13 @@ int k12_open(wtap *wth, int *err, gchar **err_info _U_) { rec->input_type = K12_PORT_ATMPVC; } + /* XXX - this is assumed, in a number of places (not just in the + ascii_strdown_inplace() call below) to be null-terminated; + is that guaranteed (even with a corrupt file)? */ rec->input_name = g_memdup(read_buffer + K12_SRCDESC_EXTRATYPE + extra_len, name_len); rec->stack_file = g_memdup(read_buffer + K12_SRCDESC_EXTRATYPE + extra_len + name_len, stack_len); - g_ascii_strdown (rec->stack_file,stack_len); + ascii_strdown_inplace (rec->stack_file); g_hash_table_insert(file_data->src_by_id,GUINT_TO_POINTER(rec->input),rec); g_hash_table_insert(file_data->src_by_name,rec->stack_file,rec); |