src/io.c: Null-terminate the ical_readline() buffer

Ensure we always return with a null-terminated buffer, even if we read
more than BUFSIZ characters.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2011-11-11 12:12:58 +01:00
parent 3aefd00f6a
commit 120f434967

View File

@ -1896,6 +1896,7 @@ ical_readline (FILE *fdi, char *buf, char *lstore, unsigned *ln)
if (*lstore != SPACE && *lstore != TAB) if (*lstore != SPACE && *lstore != TAB)
break; break;
strncat (buf, lstore + 1, BUFSIZ); strncat (buf, lstore + 1, BUFSIZ);
buf[BUFSIZ - 1] = '\0';
(*ln)++; (*ln)++;
} }