projects
/
petitboot
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
3fb8fb6
)
discover: Always add a NUL byte to config data
author
Jeremy Kerr
<jk@ozlabs.org>
Fri, 10 May 2013 02:47:24 +0000
(10:47 +0800)
committer
Jeremy Kerr
<jk@ozlabs.org>
Wed, 15 May 2013 06:37:35 +0000
(14:37 +0800)
conf_get_pair will read one-byte past the end of the conf buffer, so
always NUL-terminate.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/parser.c
patch
|
blob
|
history
diff --git
a/discover/parser.c
b/discover/parser.c
index 11728b779ce66f1af15900857e4d33168a1cc3a8..8d4c180c2c1bccc7a3a43f1da996c09f5b901f65 100644
(file)
--- a/
discover/parser.c
+++ b/
discover/parser.c
@@
-37,7
+37,7
@@
static int read_file(struct discover_context *ctx,
if (len > max_file_size)
goto err_close;
- buf = talloc_array(ctx, char, len);
+ buf = talloc_array(ctx, char, len
+ 1
);
if (!buf)
goto err_close;
@@
-55,6
+55,8
@@
static int read_file(struct discover_context *ctx,
}
+ buf[len] = '\0';
+
close(fd);
*bufp = buf;
*lenp = len;