diff options
-rw-r--r-- | src/io.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1885,6 +1885,7 @@ ical_readline (FILE *fdi, char *buf, char *lstore, unsigned *ln) if (*lstore != SPACE && *lstore != TAB) break; strncat (buf, lstore + 1, BUFSIZ); + buf[BUFSIZ - 1] = '\0'; (*ln)++; } @@ -2392,7 +2393,8 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, skip_alarm = 0; while (ical_readline (fdi, buf, lstore, lineno)) { - memcpy (buf_upper, buf, strlen (buf)); + strncpy (buf_upper, buf, BUFSIZ); + buf_upper[BUFSIZ - 1] = '\0'; str_toupper (buf_upper); if (skip_alarm) @@ -2576,7 +2578,8 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, skip_alarm = 0; while (ical_readline (fdi, buf, lstore, lineno)) { - memcpy (buf_upper, buf, strlen (buf)); + strncpy (buf_upper, buf, BUFSIZ); + buf_upper[BUFSIZ - 1] = '\0'; str_toupper (buf_upper); if (skip_alarm) { |