Skip to content

Commit a0644ea

Browse files
committed
Fix off-by-one error
1 parent e679cb6 commit a0644ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ file_read_text(struct error *err, const char *path, char **txt)
661661
if ((fs = xfopen(err, path, "r")) == NULL)
662662
return (-1);
663663
*txt = NULL;
664-
while ((n = fread(buf, 1, sizeof(buf), fs)) > 0) {
664+
while ((n = fread(buf, 1, sizeof(buf) - 1, fs)) > 0) {
665665
buf[n] = '\0';
666666
if (str_join(err, txt, buf, "") < 0)
667667
goto fail;

0 commit comments

Comments
 (0)