Mercurial > hg > freeDiameter
diff libfdproto/messages.c @ 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 | e60376cb15e8 |
children | e21d79595045 |
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; }