From: guy Date: Sat, 2 Feb 2002 21:54:04 +0000 (+0000) Subject: The argument to "proto_tree_add_string()" must be a null-terminated X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=2292e91aa72f9ae92efc09822e4d2b252d62a3a4 The argument to "proto_tree_add_string()" must be a null-terminated string; make it so. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4683 f5534014-38df-0310-8fa8-9805f1628bb7 --- 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 * Liberally copied from packet-http.c, by Guy Harris * - * $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 @@ -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);