summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-07-11 17:57:27 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-07-11 17:57:27 +0000
commitfd7dc9d1d7311b05e92464de1fc4eab6f2407b51 (patch)
tree7094df343cd204f9d381a8f1f6ac4334d87876f2 /src/libstddjb
parent7e1e6cf1584c5f1c0d6c892d013ed522fb8a8bc1 (diff)
downloadskalibs-fd7dc9d1d7311b05e92464de1fc4eab6f2407b51.tar.xz
bugfix: memcmp doesn't guarantee not touching bytes after cmp fails.
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/env_merge.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstddjb/env_merge.c b/src/libstddjb/env_merge.c
index f7ba335..9129cf3 100644
--- a/src/libstddjb/env_merge.c
+++ b/src/libstddjb/env_merge.c
@@ -16,8 +16,7 @@ size_t env_merge (char const **v, size_t vmax, char const *const *envp, size_t e
{
size_t split = str_chr(modifs + i, '=') ;
size_t j = 0 ;
- for (; j < vlen ; j++)
- if (!memcmp(modifs + i, v[j], split) && (v[j][split] == '=')) break ;
+ for (; j < vlen ; j++) if (!strncmp(modifs + i, v[j], split+1)) break ;
if (j < vlen) v[j] = v[--vlen] ;
if (modifs[i + split]) v[vlen++] = modifs + i ;
}