summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-07-16 01:15:29 +0300
committerSteve Peters <steve@fisharerojo.org>2006-07-16 13:46:35 +0000
commit1bdfa2dec136126216e8edf2320ed0ca1f645494 (patch)
tree2743a3d2296f5d5eb59790adcb3468d2a2270df6 /util.c
parent5a2bdfd0e906359696ca0db94c49d11f3999e99b (diff)
downloadperl-1bdfa2dec136126216e8edf2320ed0ca1f645494.tar.gz
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
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util.c b/util.c
index c3d59481a6..bb2eab7a6f 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);