diff --git a/src/render.c b/src/render.c index 1b642cd..509001d 100644 --- a/src/render.c +++ b/src/render.c @@ -192,6 +192,14 @@ static char* read_file(const char* path) if (ferror(stream)) goto read_failure; + if (rsize == size) { + contents = realloc(contents, size + 1); + if (!contents) + goto read_failure; + } + + contents[rsize] = '\0'; + fclose(stream); return contents;