changeset 720:2c7c423eaba9

Have AVP values 0-terminated for safety (one should not rely on this and use the size)
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 21 Feb 2011 18:30:20 +0900
parents dc71992e3378
children 01f796160f7f
files libfdproto/messages.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libfdproto/messages.c	Mon Feb 21 18:29:14 2011 +0900
+++ b/libfdproto/messages.c	Mon Feb 21 18:30:20 2011 +0900
@@ -1772,9 +1772,8 @@
 				} );
 			avp->avp_storage.os.len = avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags );
 			if (avp->avp_storage.os.len) {
-				CHECK_MALLOC(  avp->avp_storage.os.data = malloc(avp->avp_storage.os.len)  );
+				CHECK_MALLOC(  avp->avp_storage.os.data = os0dup(avp->avp_source, avp->avp_storage.os.len)  );
 				avp->avp_mustfreeos = 1;
-				memcpy(avp->avp_storage.os.data, avp->avp_source, avp->avp_storage.os.len);
 			} else {
 				avp->avp_storage.os.data = NULL;
 			}
"Welcome to our mercurial repository"