diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-04 05:05:57 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-04 05:05:57 +0000 |
commit | b48f1ba55530934180c410ecc1fb73c4bc730b30 (patch) | |
tree | 3a7b147bbfa08c73847f062fef14bfd6999a32ba /malloc.c | |
parent | 6b5cb48cda959b50de283dd498edd6abcccb1f81 (diff) | |
download | perl-b48f1ba55530934180c410ecc1fb73c4bc730b30.tar.gz |
off-by-one in malloc.c (from Ilya Zakharevich)
p4raw-id: //depot/perl@4974
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1748,9 +1748,9 @@ char * Perl_strdup(const char *s) { MEM_SIZE l = strlen(s); - char *s1 = (char *)Perl_malloc(l); + char *s1 = (char *)Perl_malloc(l+1); - Copy(s, s1, (MEM_SIZE)l, char); + Copy(s, s1, (MEM_SIZE)(l+1), char); return s1; } @@ -1776,8 +1776,8 @@ Perl_putenv(char *a) else var = Perl_malloc(l + 1); Copy(a, var, l, char); - val++; - my_setenv(var,val); + var[l + 1] = 0; + my_setenv(var, val+1); if (var != buf) Perl_mfree(var); return 0; |