summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
Diffstat (limited to 'discover')
-rw-r--r--discover/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/discover/parser.c b/discover/parser.c
index 11728b7..8d4c180 100644
--- 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;
OpenPOWER on IntegriCloud