]> andersk Git - libfaim.git/commitdiff
- Fri Sep 1 00:13:04 UTC 2000
authormid <mid>
Fri, 1 Sep 2000 00:19:52 +0000 (00:19 +0000)
committermid <mid>
Fri, 1 Sep 2000 00:19:52 +0000 (00:19 +0000)
   - Avoid zero-length mallocs in aim_tlv

aim_tlv.c

index ee260b00eb8a69ba88d8f7d8d952a78909e97551..1e893185446f135f70180ca3cd12f39685145ab6 100644 (file)
--- a/aim_tlv.c
+++ b/aim_tlv.c
@@ -45,9 +45,11 @@ struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen)
 
                cur->tlv = aim_createtlv();     
                cur->tlv->type = type;
-               cur->tlv->length = length;
-               cur->tlv->value = (u_char *)malloc(length*sizeof(u_char));
-               memcpy(cur->tlv->value, buf+pos, length);
+               cur->tlv->length = length; 
+               if (length) {
+                 cur->tlv->value = (unsigned char *)malloc(length);
+                 memcpy(cur->tlv->value, buf+pos, length);
+               } 
 
                cur->next = list;
                list = cur;
This page took 0.042411 seconds and 5 git commands to generate.