aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:52:27 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:52:27 +0100
commit42fda65969a1da58c0a8f074eb1f9eb3c5d4546b (patch)
tree45eef665958c0d60a55aa995b90594475c7f006a /lib
parent0f6353dcb40462321beffaea97e944046a61e122 (diff)
fix setenv bufsize
Diffstat (limited to 'lib')
-rw-r--r--lib/env/env.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/env/env.c b/lib/env/env.c
index 7ceaa15..669527e 100644
--- a/lib/env/env.c
+++ b/lib/env/env.c
@@ -25,6 +25,7 @@ const char *getenv(const char *key)
return ++value;
}
+#include "../io/io.h"
void setenv(const char *key, const char *value)
{
@@ -53,7 +54,7 @@ void setenv(const char *key, const char *value)
}
}
- *p = malloc((cstr_length(key) + cstr_length(key)) + 2);
+ *p = malloc((cstr_length(key) + cstr_length(value)) + 2);
char *i = *p;
while (*key) *(i++) = *(key++);