From: Nicholas Clark Date: Wed, 17 Oct 2007 16:06:21 +0000 (+0000) Subject: In Perl_my_clearenv(), under -DPERL_USE_SAFE_PUTENV, don't use X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82d8bb4934a8ea558df654435885eafe94e09dc8;p=p5sagit%2Fp5-mst-13.2.git In Perl_my_clearenv(), under -DPERL_USE_SAFE_PUTENV, don't use strlcpy() to forcibly truncate a string to a known length, when memcpy() and a write of '\0' will not only make the intent clear, but also do that exact job more efficiently. p4raw-id: //depot/perl@32125 --- diff --git a/util.c b/util.c index 83a6709..f75e5a7 100644 --- a/util.c +++ b/util.c @@ -5685,7 +5685,8 @@ Perl_my_clearenv(pTHX) bsiz = l + 1; /* + 1 for the \0. */ buf = (char*)safesysmalloc(bufsiz); } - my_strlcpy(buf, *environ, l + 1); + memcpy(buf, *environ, l); + buf[l] = '\0'; (void)unsetenv(buf); } (void)safesysfree(buf);