aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ntlmssp.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-ntlmssp.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-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,