Do not read past NUL character in ical_get_value()

Make sure we never read beyond the end of the buffer, even if the
terminating quote of a quoted string is missing.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2017-02-08 07:32:35 +01:00
parent e4e2e0eb20
commit ed6035afb1

View File

@ -676,10 +676,10 @@ static long ical_compute_rpt_until(long start, ical_rpt_t * rpt)
static char *ical_get_value(char *p)
{
for (; *p != ':'; p++) {
if (*p == '"')
for (p++; *p != '"' && *p != '\0'; p++);
if (*p == '\0')
return NULL;
if (*p == '"')
for (p++; *p != '"'; p++);
}
return p + 1;