aboutsummaryrefslogtreecommitdiffstats
path: root/packet-telnet.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-25 09:31:07 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-25 09:31:07 +0000
commit72640317de9493fbe6501ce35bce5a290d71f109 (patch)
tree4e9d5900443b375741a9966dee096dee52c01a1c /packet-telnet.c
parent965bdb9528126d44b30daed2f340f031748068e9 (diff)
Use "tvb_get_string()" instead of allocating a (len+1)-sized buffer,
"tvb_memcpy()"ing to it, and putting in a null terminator; "tvb_get_string()" will check whether all bytes of the string are present before allocating the buffer, so that you don't leak memory if the copy throws an exception, and don't crash if the length is absurdly large. Use "tvb_memdup()" instead of allocating a buffer and "tvb_memcpy()"ing to it, so that an exception is thrown before you try to allocate the buffer (for the same reasons as listed above). Before allocating a buffer used when processing a chunk of data from a packet, get a pointer to the chunk with "tvb_get_ptr()", or check that the data is all there with "tvb_ensure_bytes_exist()", so that an exception is thrown before you try to allocate the buffer (for the same reasons as listed above). Fix up the lengths of the tvbuff used when dissecting ONC RPC opaque data with a particular dissector. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10236 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-telnet.c')
-rw-r--r--packet-telnet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/packet-telnet.c b/packet-telnet.c
index 63255a8895..a416c94420 100644
--- a/packet-telnet.c
+++ b/packet-telnet.c
@@ -2,7 +2,7 @@
* Routines for Telnet packet dissection; see RFC 854 and RFC 855
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-telnet.c,v 1.44 2004/02/03 18:41:19 guy Exp $
+ * $Id: packet-telnet.c,v 1.45 2004/02/25 09:31:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -707,11 +707,11 @@ unescape_and_tvbuffify_telnet_option(packet_info *pinfo, tvbuff_t *tvb, int offs
if(len>=MAX_KRB5_BLOB_LEN)
return NULL;
+ spos=tvb_get_ptr(tvb, offset, len);
/* XXX we never g_free() this one. This is done automagically
when the parent tvb is destroyed?
*/
buf=g_malloc(len);
- spos=tvb_get_ptr(tvb, offset, len);
dpos=buf;
skip=0;
l=len;