diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-07-31 23:47:35 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-07-31 23:47:35 +0000 |
commit | d69644de85148f56efeed4259a783881e2a1bddc (patch) | |
tree | 0985ae502f2cf6a4b3c28e041b8caa85eaece0e8 /src | |
parent | 2dd8af0dfa6ecdb61b8bd7f2926aa959db093bf6 (diff) | |
download | skalibs-d69644de85148f56efeed4259a783881e2a1bddc.tar.xz |
bugfix: env_dump() unterminated strings
Diffstat (limited to 'src')
-rw-r--r-- | src/libstddjb/env_dump.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstddjb/env_dump.c b/src/libstddjb/env_dump.c index fc79bc3..10f5913 100644 --- a/src/libstddjb/env_dump.c +++ b/src/libstddjb/env_dump.c @@ -32,7 +32,8 @@ int env_dump (char const *dir, mode_t mode, char const *const *envp) size_t len = str_chr(*envp, '=') ; size_t vallen = strlen(*envp + len + 1) ; char fn[len + 1] ; - memcpy(fn, *envp, len + 1) ; + memcpy(fn, *envp, len) ; + fn[len] = 0 ; len = openwritenclose_at(fd, fn, *envp + len + 1, vallen) ; if (len < vallen) goto cerr ; } |