aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-spnego.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-08-19 14:55:41 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-08-19 14:55:41 +0000
commitb46f9bebe29e215e0b84242771a92f1bbe6fdb38 (patch)
tree45c8664141827cb3018c2c7b2407fb906e4dad53 /epan/dissectors/packet-spnego.c
parent02cae558f997dba1fd17011cc84e317f17d17a4d (diff)
Change some dissectors to use pinfo memory pool instead of malloc if it can trigger an exception between between buffer allocation and tvb_set_free_cb call
svn path=/trunk/; revision=51427
Diffstat (limited to 'epan/dissectors/packet-spnego.c')
-rw-r--r--epan/dissectors/packet-spnego.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c
index ed8bc9bc2d..012705f9cf 100644
--- a/epan/dissectors/packet-spnego.c
+++ b/epan/dissectors/packet-spnego.c
@@ -1051,18 +1051,9 @@ decrypt_gssapi_krb_arcfour_wrap(proto_tree *tree, packet_info *pinfo, tvbuff_t *
int length;
const guint8 *original_data;
- static int omb_index=0;
- static guint8 *omb_arr[4]={NULL,NULL,NULL,NULL};
- static guint8 *cryptocopy=NULL; /* workaround for pre-0.6.1 heimdal bug */
+ guint8 *cryptocopy=NULL; /* workaround for pre-0.6.1 heimdal bug */
guint8 *output_message_buffer;
- omb_index++;
- if(omb_index>=4){
- omb_index=0;
- }
- output_message_buffer=omb_arr[omb_index];
-
-
length=tvb_length(pinfo->gssapi_encrypted_tvb);
original_data=tvb_get_ptr(pinfo->gssapi_encrypted_tvb, 0, length);
@@ -1076,11 +1067,7 @@ decrypt_gssapi_krb_arcfour_wrap(proto_tree *tree, packet_info *pinfo, tvbuff_t *
/* XXX We also need to re-read the keytab when the preference changes */
cryptocopy=(guint8 *)wmem_alloc(wmem_packet_scope(), length);
- if(output_message_buffer){
- g_free(output_message_buffer);
- output_message_buffer=NULL;
- }
- output_message_buffer=(guint8 *)g_malloc(length);
+ output_message_buffer=(guint8 *)wmem_alloc(pinfo->pool, length);
for(ek=enc_key_list;ek;ek=ek->next){
/* shortcircuit and bail out if enctypes are not matching */
@@ -1107,7 +1094,6 @@ decrypt_gssapi_krb_arcfour_wrap(proto_tree *tree, packet_info *pinfo, tvbuff_t *
pinfo->gssapi_decrypted_tvb=tvb_new_child_real_data(tvb,
output_message_buffer,
ret, ret);
- tvb_set_free_cb(pinfo->gssapi_decrypted_tvb, g_free);
add_new_data_source(pinfo, pinfo->gssapi_decrypted_tvb, "Decrypted GSS-Krb5");
return;
}
@@ -1185,7 +1171,7 @@ decrypt_gssapi_krb_cfx_wrap(proto_tree *tree _U_,
datalen = tvb_length(checksum_tvb) + tvb_length(encrypted_tvb);
- rotated = (guint8 *)g_malloc(datalen);
+ rotated = (guint8 *)wmem_alloc(pinfo->pool, datalen);
tvb_memcpy(checksum_tvb, rotated,
0, tvb_length(checksum_tvb));
@@ -1200,7 +1186,6 @@ decrypt_gssapi_krb_cfx_wrap(proto_tree *tree _U_,
next_tvb=tvb_new_child_real_data(encrypted_tvb, rotated,
datalen, datalen);
- tvb_set_free_cb(next_tvb, g_free);
add_new_data_source(pinfo, next_tvb, "GSSAPI CFX");
output = decrypt_krb5_data(tree, pinfo, usage, next_tvb,
@@ -1959,7 +1944,7 @@ void proto_register_spnego(void) {
NULL, HFILL }},
/*--- End of included file: packet-spnego-hfarr.c ---*/
-#line 1393 "../../asn1/spnego/packet-spnego-template.c"
+#line 1378 "../../asn1/spnego/packet-spnego-template.c"
};
/* List of subtrees */
@@ -1981,7 +1966,7 @@ void proto_register_spnego(void) {
&ett_spnego_InitialContextToken_U,
/*--- End of included file: packet-spnego-ettarr.c ---*/
-#line 1403 "../../asn1/spnego/packet-spnego-template.c"
+#line 1388 "../../asn1/spnego/packet-spnego-template.c"
};
/* Register protocol */