From 87430957089fb09911a84d49dffeca71597e50a7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 13 Sep 2020 16:12:42 -0700 Subject: Added null terminator and closed file handler --- utils.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 95fe0f0..5078c01 100644 --- a/utils.c +++ b/utils.c @@ -167,6 +167,8 @@ char *readfile(int fd) if (len >= capacity) buf = realloc(buf, sizeof(char)*(capacity *= 2)); } + buf[len] = '\0'; + close(fd); return &buf[1]; } -- cgit v1.2.3