From 62968599557ac81b0f811481f6b06886ddcf0cdb Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 22 Jan 2016 19:07:52 +0000 Subject: [PATCH] Fix off-by-one in buffer length in int_to_env We need to allow for '=', negative sign, 10 digits and the null terminator, adding up to 13 bytes not 12. Signed-off-by: Ben Hutchings --- src/script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script.c b/src/script.c index 83fbea5..89cb0d6 100644 --- a/src/script.c +++ b/src/script.c @@ -227,7 +227,7 @@ static void search_to_env(const char *name, const uint8_t *start, size_t len) static void int_to_env(const char *name, int value) { - size_t len = 12 + strlen(name); + size_t len = 13 + strlen(name); char *buf = realloc(NULL, len); snprintf(buf, len, "%s=%d", name, value); putenv(buf); -- 2.25.1