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:
parent
3aefd00f6a
commit
120f434967
1
src/io.c
1
src/io.c
@ -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)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user