]> andersk Git - libfaim.git/blobdiff - aim_tlv.c
- Fri Sep 1 00:13:04 UTC 2000
[libfaim.git] / 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.037812 seconds and 4 git commands to generate.