projects
/
oweals
/
odhcp6c.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6bbd1d
)
Fix off-by-one in buffer length in int_to_env
author
Ben Hutchings
<ben@decadent.org.uk>
Fri, 22 Jan 2016 19:07:52 +0000
(19:07 +0000)
committer
Ben Hutchings
<ben@decadent.org.uk>
Thu, 28 Jan 2016 13:30:14 +0000
(13:30 +0000)
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 <ben@decadent.org.uk>
src/script.c
patch
|
blob
|
history
diff --git
a/src/script.c
b/src/script.c
index 83fbea5a2c37e2b18cfa2966e319b42cff55a17e..89cb0d69eab831fea854b71e6165552f4b89138f 100644
(file)
--- 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 = 1
2
+ strlen(name);
+ size_t len = 1
3
+ strlen(name);
char *buf = realloc(NULL, len);
snprintf(buf, len, "%s=%d", name, value);
putenv(buf);