Validate date/time when scanning items
Bail out when reading dates such as "02/30/2013" from the appointments file. These *could* be converted into valid dates but since we never write invalid dates to that file, these indicate a user error. Fixes following test cases: * appointment-009.sh * appointment-012.sh * appointment-016.sh * appointment-019.sh * event-003.sh Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
@@ -125,6 +125,10 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note)
|
||||
char buf[BUFSIZ], *nl;
|
||||
time_t tstart;
|
||||
|
||||
EXIT_IF(!check_date(start.tm_year, start.tm_mon, start.tm_mday) ||
|
||||
!check_time(start.tm_hour, start.tm_min),
|
||||
_("date error in event"));
|
||||
|
||||
/* Read the event description */
|
||||
if (!fgets(buf, sizeof buf, f))
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user