diff options
author | Josiah Frentsos via skaware <skaware@list.skarnet.org> | 2023-10-19 13:01:43 -0400 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-28 13:15:55 +0000 |
commit | 83ff0ca30e725c25b8b7e6d78ff17246caf29cf8 (patch) | |
tree | ed5f505237d9f30ba0dbb1b554417089b032ae6f /src/libenvexec | |
parent | d452fcefe0220893ef1a8f868640809b4766480c (diff) | |
download | skalibs-83ff0ca30e725c25b8b7e6d78ff17246caf29cf8.tar.gz skalibs-83ff0ca30e725c25b8b7e6d78ff17246caf29cf8.tar.xz skalibs-83ff0ca30e725c25b8b7e6d78ff17246caf29cf8.zip |
Fix envalloc_merge
Currently, envalloc_merge incorrectly passes the total number of environment entries to env_mergen as the number of modifs. Signed-off-by: Josiah Frentsos <jfrent@tilde.team>
Diffstat (limited to 'src/libenvexec')
-rw-r--r-- | src/libenvexec/envalloc_merge.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libenvexec/envalloc_merge.c b/src/libenvexec/envalloc_merge.c index 84716e4..2c6ea0e 100644 --- a/src/libenvexec/envalloc_merge.c +++ b/src/libenvexec/envalloc_merge.c @@ -7,9 +7,10 @@ int envalloc_merge (genalloc *v, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen) { - size_t n = envlen + 1 + byte_count(modifs, modiflen, '\0') ; + size_t modifn = byte_count(modifs, modiflen, '\0') ; + size_t n = envlen + 1 + modifn ; if (!genalloc_readyplus(char const *, v, n)) return 0 ; - n = env_mergen(genalloc_s(char const *, v) + genalloc_len(char const *, v), n, envp, envlen, modifs, modiflen, n) ; + n = env_mergen(genalloc_s(char const *, v) + genalloc_len(char const *, v), n, envp, envlen, modifs, modiflen, modifn) ; genalloc_setlen(char const *, v, genalloc_len(char const *, v) + n) ; return 1 ; } |