diff options
author | Gerald Combs <gerald@wireshark.org> | 2004-05-05 03:05:52 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2004-05-05 03:05:52 +0000 |
commit | ed22e7941fe188219ba2dbe55dea89a8bcf5048b (patch) | |
tree | a15da3994a606d6b4c467cd36f1e1b5a4c4c1f05 | |
parent | 4b4298b6fd620a9f011c14e36eea3c8c2f2fd2bb (diff) | |
download | wireshark-ed22e7941fe188219ba2dbe55dea89a8bcf5048b.tar.gz |
Check the value length in get_encoded_strval(), so that we don't feed a
length less than 1 to tvb_get_string().
svn path=/trunk/; revision=10798
-rw-r--r-- | packet-mmse.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packet-mmse.c b/packet-mmse.c index f5e0873fbc..8c2a57e9b7 100644 --- a/packet-mmse.c +++ b/packet-mmse.c @@ -3,7 +3,7 @@ * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl> * Copyright 2004, Olivier Biot * - * $Id: packet-mmse.c,v 1.34 2004/04/20 23:54:19 obiot Exp $ + * $Id: packet-mmse.c,v 1.35 2004/05/05 03:05:52 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -467,7 +467,7 @@ get_text_string(tvbuff_t *tvb, guint offset, char **strval) guint len; DebugLog(("get_text_string(tvb = %p, offset = %u, **strval) - start\n", - vb, offset)); + tvb, offset)); len = tvb_strsize(tvb, offset); DebugLog((" [1] tvb_strsize(tvb, offset) == %u\n", len)); if (tvb_get_guint8(tvb, offset) == MM_QUOTE) @@ -532,8 +532,12 @@ get_encoded_strval(tvbuff_t *tvb, guint offset, char **strval) if (field < 32) { length = get_value_length(tvb, offset, &count); - /* \todo Something with "Char-set", skip for now */ - *strval = (char *)tvb_get_string(tvb, offset + count + 1, length - 1); + if (length < 2) { + *strval = g_strdup(""); + } else { + /* \todo Something with "Char-set", skip for now */ + *strval = (char *)tvb_get_string(tvb, offset + count + 1, length - 1); + } return count + length; } else return get_text_string(tvb, offset, strval); |