aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-kerberos.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2010-01-02 09:46:16 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2010-01-02 09:46:16 +0000
commitf6a4b4dc552a15d613e3174c0d4d69170f815088 (patch)
tree51df04c46d2ad1c10a02b1d69ae7162ac8365825 /epan/dissectors/packet-kerberos.c
parent7669e17a3716c9dff7aa27b5964ad5a48e4421c2 (diff)
From Jakub Zawadzki:
Cleanup dissector code - use proper memory functions. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4164 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31408 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-kerberos.c')
-rw-r--r--epan/dissectors/packet-kerberos.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 11611a2068..03d5fa7b94 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -717,8 +717,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
keys. So just give it a copy of the crypto data instead.
This has been seen for RC4-HMAC blobs.
*/
- cryptocopy=g_malloc(length);
- memcpy(cryptocopy, cryptotext, length);
+ cryptocopy=g_memdup(cryptotext, length);
ret = krb5_decrypt_ivec(krb5_ctx, crypto, usage,
cryptocopy, length,
&data,
@@ -731,8 +730,7 @@ printf("woohoo decrypted keytype:%d in frame:%u\n", ek->keytype, pinfo->fd->num)
proto_tree_add_text(tree, NULL, 0, 0, "[Decrypted using: %s]", ek->key_origin);
krb5_crypto_destroy(krb5_ctx, crypto);
/* return a private g_malloced blob to the caller */
- user_data=g_malloc(data.length);
- memcpy(user_data, data.data, data.length);
+ user_data=g_memdup(data.data, data.length);
if (datalen) {
*datalen = data.length;
}
@@ -772,8 +770,7 @@ printf("added key in %u\n",pinfo->fd->num);
new_key->kvno = 0;
new_key->keytype = keytype;
new_key->length = keylength;
- new_key->contents = g_malloc(keylength);
- memcpy(new_key->contents, keyvalue, keylength);
+ new_key->contents = g_memdup(keyvalue, keylength);
g_snprintf(new_key->origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %u", origin, pinfo->fd->num);
service_key_list = g_slist_append(service_key_list, (gpointer) new_key);
}
@@ -829,8 +826,7 @@ read_keytab_file(const char *service_key_file)
sk->kvno = buf[0] << 8 | buf[1];
sk->keytype = KEYTYPE_DES3_CBC_MD5;
sk->length = DES3_KEY_SIZE;
- sk->contents = g_malloc(DES3_KEY_SIZE);
- memcpy(sk->contents, buf + 2, DES3_KEY_SIZE);
+ sk->contents = g_memdup(buf + 2, DES3_KEY_SIZE);
g_snprintf(sk->origin, KRB_MAX_ORIG_LEN, "3DES service key file, key #%d, offset %ld", count, ftell(skf));
service_key_list = g_slist_append(service_key_list, (gpointer) sk);
fseek(skf, newline_skip, SEEK_CUR);