diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-17 16:06:21 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-17 16:06:21 +0000 |
commit | beb14e00a4c116397572611df1d58bb3d3362396 (patch) | |
tree | d1c1af14c57b8da969c05db58664677d47d37625 /util.c | |
parent | 5556cc80e4e5fae0865200caa1fc08761a538226 (diff) | |
download | perl-beb14e00a4c116397572611df1d58bb3d3362396.tar.gz |
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
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |