summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--src/util/envp.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index ed42e9f..7660666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,9 @@ check_set_ccopt -fstack-protector-strong \
check_set_ccopt -fstack-clash-protection \
|| check_set_ccopt -fstack-check # fallback
+check_set_ccopt -fanalyzer
+check_set_ccopt -fsanitize=undefined
+
# Check compiler capabilities
AX_C___ATTRIBUTE__
diff --git a/src/util/envp.c b/src/util/envp.c
index ca3c848..26e4b14 100644
--- a/src/util/envp.c
+++ b/src/util/envp.c
@@ -171,7 +171,14 @@ void envp_merge(envp_t *dest, envp_t *const src) {
#endif
for (size_t i = 0; NULL != (*src)[i]; ++i) {
- envp_put(dest, strdup((*src)[i]));
+ char *vdup = strdup((*src)[i]);
+ if (NULL == vdup) continue;
+
+ if (0 != envp_put(dest, vdup)) {
+ /* setting value failed */
+ free(vdup);
+ continue;
+ }
}
}