summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libenvexec/envalloc_merge.c5
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 ;
}