diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2013-11-30 21:27:11 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2013-11-30 21:27:11 +0000 |
commit | 670dd3f08f3ce2f9033d7ccd6775ba03c2f5af25 (patch) | |
tree | c17a94fbfcf3043c6d204ab64d6206f30a61de7c /bin/sh/memalloc.c | |
parent | 9d22cb2e69aef3a0dd861dce2910357e900bc208 (diff) | |
download | src-test2-670dd3f08f3ce2f9033d7ccd6775ba03c2f5af25.tar.gz src-test2-670dd3f08f3ce2f9033d7ccd6775ba03c2f5af25.zip |
Notes
Diffstat (limited to 'bin/sh/memalloc.c')
-rw-r--r-- | bin/sh/memalloc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index cb330d0ec0fa..119f12e9fc74 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -98,9 +98,11 @@ char * savestr(const char *s) { char *p; + size_t len; - p = ckmalloc(strlen(s) + 1); - scopy(s, p); + len = strlen(s); + p = ckmalloc(len + 1); + memcpy(p, s, len + 1); return p; } |