aboutsummaryrefslogtreecommitdiff
path: root/booki.c
diff options
context:
space:
mode:
Diffstat (limited to 'booki.c')
-rw-r--r--booki.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/booki.c b/booki.c
index afca7ed..a90edeb 100644
--- a/booki.c
+++ b/booki.c
@@ -285,7 +285,7 @@ char* load_file(char* filename) {
int size = ftell(fp);
rewind(fp);
- char* data = malloc(size);
+ char* data = malloc(size + 1);
if (!data) {
printf("couldn't malloc\n");
return NULL;
@@ -297,6 +297,7 @@ char* load_file(char* filename) {
return NULL;
}
+ data[size] = '\0';
fclose(fp);
return data;