From: Jarkko Hietaniemi Date: Sat, 15 Jul 2006 22:15:29 +0000 (+0300) Subject: Re: [PATCH] various safety/portability tweaks X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1bdfa2dec136126216e8edf2320ed0ca1f645494;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] various safety/portability tweaks Message-ID: <44B93ED1.7080000@iki.fi> Fix for change #28578. p4raw-link: @28578 on //depot/perl: d130778686fc2c04eb7d731512df9e71304d5573 p4raw-id: //depot/perl@28585 --- diff --git a/util.c b/util.c index c3d5948..bb2eab7 100644 --- a/util.c +++ b/util.c @@ -5465,11 +5465,10 @@ Perl_my_clearenv(pTHX) int l = e ? e - *environ : strlen(*environ); if (bsiz < l + 1) { (void)safesysfree(buf); - bsiz = l + 1; + bsiz = l + 1; /* + 1 for the \0. */ buf = (char*)safesysmalloc(bufsiz); } - my_strlcpy(buf, bufsiz, *environ, l); - *(buf + l) = '\0'; + my_strlcpy(buf, *environ, l + 1); (void)unsetenv(buf); } (void)safesysfree(buf);