changeset 818:f425f51a3db8

[gaim-migrate @ 828] libfaim committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 01 Sep 2000 00:21:36 +0000
parents aefd5f2b1ea0
children 2f0f06f7319f
files libfaim/aim_tlv.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/aim_tlv.c	Fri Sep 01 00:03:58 2000 +0000
+++ b/libfaim/aim_tlv.c	Fri Sep 01 00:21:36 2000 +0000
@@ -45,9 +45,11 @@
 
 		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;