diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-08-17 09:25:04 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-08-17 09:25:04 +0000 |
commit | 4c1b32d94da2697205ad915be5665610f5e8032f (patch) | |
tree | 83b8fa69a071b1d90074514e5274914e884ba080 /epan/dissectors/packet-smb-common.c | |
parent | 1df55c8071cd1ca52623030bcdcda567517c2b6d (diff) |
replace a whole bunch of silly rotating stating buffers with ep_alloc() calls
this should fix a whole number of display bugs when there are too many such pdus in a single frame for the silly buffers to handle before they wrap.
svn path=/trunk/; revision=15384
Diffstat (limited to 'epan/dissectors/packet-smb-common.c')
-rw-r--r-- | epan/dissectors/packet-smb-common.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/epan/dissectors/packet-smb-common.c b/epan/dissectors/packet-smb-common.c index 6619010ada..8042b01b11 100644 --- a/epan/dissectors/packet-smb-common.c +++ b/epan/dissectors/packet-smb-common.c @@ -34,6 +34,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/emem.h> #include "packet-smb-common.h" /* @@ -142,21 +143,14 @@ static gchar * unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, guint16 bc) { - static gchar str[3][MAX_UNICODE_STR_LEN+3+1]; - static gchar *cur; + gchar *cur; gchar *p; guint16 uchar; int len; int us_len; gboolean overflow = FALSE; - if (cur == &str[0][0]) { - cur = &str[1][0]; - } else if (cur == &str[1][0]) { - cur = &str[2][0]; - } else { - cur = &str[0][0]; - } + cur=ep_alloc(MAX_UNICODE_STR_LEN+3+1); p = cur; len = MAX_UNICODE_STR_LEN; us_len = 0; @@ -212,8 +206,7 @@ get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp, gboolean useunicode, int *len, gboolean nopad, gboolean exactlen, guint16 *bcp) { - static gchar str[3][MAX_UNICODE_STR_LEN+3+1]; - static gchar *cur; + gchar *cur; const gchar *string; int string_len; int copylen; @@ -247,13 +240,7 @@ get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp, /* * The string we return must be null-terminated. */ - if (cur == &str[0][0]) { - cur = &str[1][0]; - } else if (cur == &str[1][0]) { - cur = &str[2][0]; - } else { - cur = &str[0][0]; - } + cur=ep_alloc(MAX_UNICODE_STR_LEN+3+1); copylen = *len; if (copylen < 0) { /* This probably means it's a very large unsigned number; just set |