summaryrefslogtreecommitdiff
path: root/lib/hashtable.c
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-07-06 18:26:12 -0600
committerTom Rini <[email protected]>2026-07-06 18:26:12 -0600
commitee5d46b45ec0c63f8f9dd1e816e0dac3452ccc3d (patch)
tree800cd9e204ca027144070101884c0d5d3c00130f /lib/hashtable.c
parentece349ade2973e220f524ce59e59711cc919263f (diff)
parenta18265f1ccb7a272721ed4286ed3b5a6182ff424 (diff)
Merge branch 'next'
Diffstat (limited to 'lib/hashtable.c')
-rw-r--r--lib/hashtable.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 75c263b5053..f96a8e686f6 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -821,13 +821,12 @@ int himport_r(struct hsearch_data *htab,
}
/* we allocate new space to make sure we can write to the array */
- if ((data = malloc(size + 1)) == NULL) {
- debug("himport_r: can't malloc %lu bytes\n", (ulong)size + 1);
+ data = memdup_nul(env, size);
+ if (data == NULL) {
+ debug("himport_r: can't duplicate env block\n");
__set_errno(ENOMEM);
return 0;
}
- memcpy(data, env, size);
- data[size] = '\0';
dp = data;
/* make a local copy of the list of variables */