aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ntlmssp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-02-25 09:31:07 +0000
committerGuy Harris <guy@alum.mit.edu>2004-02-25 09:31:07 +0000
commit857318d3b760aa1ee27b9025746e1f39ce946a53 (patch)
tree4e9d5900443b375741a9966dee096dee52c01a1c /packet-ntlmssp.c
parent3353ca1d5a8307ce1ae6afd49b3f7525596e0910 (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. svn path=/trunk/; revision=10236
Diffstat (limited to 'packet-ntlmssp.c')
-rw-r--r--packet-ntlmssp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/packet-ntlmssp.c b/packet-ntlmssp.c
index 0538692dce..c8fdb675e2 100644
--- a/packet-ntlmssp.c
+++ b/packet-ntlmssp.c
@@ -3,7 +3,7 @@
* Devin Heitmueller <dheitmueller@netilla.com>
* Copyright 2003, Tim Potter <tpot@samba.org>
*
- * $Id: packet-ntlmssp.c,v 1.46 2004/01/19 20:10:36 jmayer Exp $
+ * $Id: packet-ntlmssp.c,v 1.47 2004/02/25 09:31:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1268,11 +1268,10 @@ dissect_ntlmssp_encrypted_payload(tvbuff_t *tvb, int offset,
/* Store the decrypted contents in the packet state struct
(of course at this point, they aren't decrypted yet) */
- packet_ntlmssp_info->decrypted_payload = g_malloc (encrypted_block_length);
+ packet_ntlmssp_info->decrypted_payload = tvb_memdup(tvb, offset,
+ encrypted_block_length);
decrypted_payloads = g_slist_prepend(decrypted_payloads,
packet_ntlmssp_info->decrypted_payload);
- tvb_memcpy(tvb, packet_ntlmssp_info->decrypted_payload,
- offset, encrypted_block_length);
/* Do the decryption of the payload */
crypt_rc4(rc4_state, packet_ntlmssp_info->decrypted_payload,