summaryrefslogtreecommitdiff
path: root/packet-sdp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-02 21:54:04 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-02 21:54:04 +0000
commit0031b4d243fe974193b839e95ca48443b2ec62a5 (patch)
tree7bb5cd2675affe8df3f1c7c1392709501c23da29 /packet-sdp.c
parentdb4892b8a3e55ec3369340c8f314abe48a95bdbd (diff)
downloadwireshark-0031b4d243fe974193b839e95ca48443b2ec62a5.tar.gz
The argument to "proto_tree_add_string()" must be a null-terminated
string; make it so. svn path=/trunk/; revision=4683
Diffstat (limited to 'packet-sdp.c')
-rw-r--r--packet-sdp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/packet-sdp.c b/packet-sdp.c
index 516c910955..57e6506684 100644
--- a/packet-sdp.c
+++ b/packet-sdp.c
@@ -4,7 +4,7 @@
* Jason Lango <jal@netapp.com>
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
*
- * $Id: packet-sdp.c,v 1.27 2002/02/02 02:52:41 guy Exp $
+ * $Id: packet-sdp.c,v 1.28 2002/02/02 21:54:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -167,6 +167,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int datalen;
int tokenoffset;
int hf = -1;
+ char *string;
/*
* As RFC 2327 says, "SDP is purely a format for session
@@ -297,11 +298,14 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tokenoffset = 2;
if( hf == hf_unknown || hf == hf_misplaced )
tokenoffset = 0;
+ string = g_malloc(linelen - tokenoffset + 1);
+ CLEANUP_PUSH(g_free, string);
+ tvb_memcpy(tvb, (guint8 *)string, offset + tokenoffset,
+ linelen - tokenoffset);
+ string[linelen - tokenoffset] = '\0';
sub_ti = proto_tree_add_string(sdp_tree,hf,tvb, offset,
- linelen,
- tvb_get_ptr(tvb,
- offset+tokenoffset,
- linelen - tokenoffset));
+ linelen, string);
+ CLEANUP_CALL_AND_POP;
call_sdp_subdissector(tvb_new_subset(tvb,offset+tokenoffset,
linelen-tokenoffset,-1),
pinfo,tree,hf,sub_ti);