Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/ipsec-tools-0_8-branch]: src/crypto/dist/ipsec-tools/src/racoon From Rai...



details:   https://anonhg.NetBSD.org/src/rev/d5c09e16d1f8
branches:  ipsec-tools-0_8-branch
changeset: 763325:d5c09e16d1f8
user:      tteras <tteras%NetBSD.org@localhost>
date:      Sun Jan 01 17:32:04 2012 +0000

description:
>From Rainer Weikusat <rweikusat%mobileactivedefense.com@localhost>: Fix one byte too
short memory allocation in isakmp_unity.c:splitnet_list_2str().

diffstat:

 crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 32f20b659a5e -r d5c09e16d1f8 crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c
--- a/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c Thu Nov 17 14:46:31 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c Sun Jan 01 17:32:04 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isakmp_unity.c,v 1.9 2007/10/19 03:37:19 manu Exp $    */
+/*     $NetBSD: isakmp_unity.c,v 1.9.18.1 2012/01/01 17:32:04 tteras Exp $     */
 
 /* Id: isakmp_unity.c,v 1.10 2006/07/31 04:49:23 manubsd Exp */
 
@@ -387,8 +387,9 @@
                netentry = netentry->next;
        }
 
-       /* allocate network list string */
-       str = racoon_malloc(len);
+       /* allocate network list string; we need the extra byte temporarily
+        * as sprintf() will write trailing 0-byte after the space. */
+       str = racoon_malloc(len + 1);
        if (str == NULL)
                return NULL;
 
@@ -414,6 +415,7 @@
                netentry = netentry->next;
        }
 
+       /* trim the string to not have trailing spaces */
        str[len-1]=0;
 
        return str;



Home | Main Index | Thread Index | Old Index