aboutsummaryrefslogtreecommitdiffstats
path: root/packet-x11.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-25 23:12:49 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-25 23:12:49 +0000
commitd4dbc48e29fb8e02e0962143653c686ab21f9e62 (patch)
tree73942d48f0f827d4f5fbced846f6127b04de517d /packet-x11.c
parent611bbf834579b9baad49f0e6664c2300828a79da (diff)
Make sure the keysym list is present before allocating a buffer to hold
it. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10241 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-x11.c')
-rw-r--r--packet-x11.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/packet-x11.c b/packet-x11.c
index 003a4e9f92..6f791e1823 100644
--- a/packet-x11.c
+++ b/packet-x11.c
@@ -3,7 +3,7 @@
* Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
* Copyright 2003, Michael Shuldman
*
- * $Id: packet-x11.c,v 1.54 2004/02/25 09:31:07 guy Exp $
+ * $Id: packet-x11.c,v 1.55 2004/02/25 23:12:49 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1741,14 +1741,15 @@ static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
for (keycode = keycode_first; keycode_count > 0;
- ++keycode, --keycode_count) {
+ ++keycode, --keycode_count) {
tti = proto_tree_add_none_format(tt, hf_item, tvb, *offsetp,
keysyms_per_keycode * 4, "keysyms (keycode %d):", keycode);
ttt = proto_item_add_subtree(tti, ett_x11_keysym);
+ tvb_ensure_bytes_exist(tvb, *offsetp, 4 * keysyms_per_keycode);
keycodemap[keycode]
- = g_malloc(sizeof(*keycodemap[keycode]) * keysyms_per_keycode);
+ = g_malloc(sizeof(*keycodemap[keycode]) * keysyms_per_keycode);
for(i = 0; i < keysyms_per_keycode; ++i) {
/* keysymvalue = byte3 * 256 + byte4. */
@@ -1756,9 +1757,9 @@ static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
proto_item_append_text(tti, " %s", keysymString(v));
proto_tree_add_uint_format(ttt, hf_x11_keysyms_item_keysym,
- tvb, *offsetp, 4, v,
- "keysym (keycode %d): 0x%08x (%s)",
- keycode, v, keysymString(v));
+ tvb, *offsetp, 4, v,
+ "keysym (keycode %d): 0x%08x (%s)",
+ keycode, v, keysymString(v));
keycodemap[keycode][i] = v;
*offsetp += 4;