diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-03-07 22:46:04 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-03-07 22:46:04 +0000 |
commit | 4a4650b2738fdb8d40b7b39e821fda7b06e9fc8a (patch) | |
tree | 4b62dc4e7bc91d681c0c619bff10657c135a9984 /plugins/irda/packet-ircomm.c | |
parent | 1d2c14be6670ba86769292800d0164aca5efc2d0 (diff) | |
download | wireshark-4a4650b2738fdb8d40b7b39e821fda7b06e9fc8a.tar.gz wireshark-4a4650b2738fdb8d40b7b39e821fda7b06e9fc8a.tar.bz2 wireshark-4a4650b2738fdb8d40b7b39e821fda7b06e9fc8a.zip |
Fetch the port name string using "tvb_get_string()", so that we don't
have to worry about overflowing a buffer; thanks to Stefan Esser for
catching that one. (It also means we handle it if there's no '\0' at
the end.)
svn path=/trunk/; revision=10341
Diffstat (limited to 'plugins/irda/packet-ircomm.c')
-rw-r--r-- | plugins/irda/packet-ircomm.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/irda/packet-ircomm.c b/plugins/irda/packet-ircomm.c index 539a131ba4..f67c90bab7 100644 --- a/plugins/irda/packet-ircomm.c +++ b/plugins/irda/packet-ircomm.c @@ -3,7 +3,7 @@ * By Jan Kiszka <jan.kiszka@web.de> * Copyright 2003 Jan Kiszka * - * $Id: packet-ircomm.c,v 1.1 2003/12/18 19:07:12 guy Exp $ + * $Id: packet-ircomm.c,v 1.2 2004/03/07 22:46:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -47,6 +47,14 @@ # include "snprintf.h" #endif +/* + * See + * + * http://www.irda.org/standards/specifications.asp + * + * for various IrDA specifications. + */ + #include "irda-appl.h" @@ -268,6 +276,7 @@ static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, unsigned offset, packet proto_item* ti; proto_tree* p_tree; char buf[256]; + char *str; guint8 pv; @@ -326,12 +335,11 @@ static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, unsigned offset, packet break; case IRCOMM_PORT_NAME: - proto_item_append_text(ti, ": Port Name (\""); - - tvb_memcpy(tvb, buf, offset+2, p_len); - strcat(buf, "\")"); - - proto_item_append_text(ti, buf); + /* XXX - the IrCOMM V1.0 spec says this "Normally + human readable text, but not required". */ + str = tvb_get_string(tvb, offset+2, p_len); + proto_item_append_text(ti, ": Port Name (\"%s\")", str); + g_free(str); break; |