Browse Source

Put some sanity checks on the times that can be input.

Con Kolivas 14 years ago
parent
commit
ed7389e87e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      main.c

+ 2 - 0
main.c

@@ -1097,6 +1097,8 @@ static char *set_schedtime(const char *arg, struct schedtime *st)
 {
 	if (sscanf(arg, "%d:%d", &st->tm.tm_hour, &st->tm.tm_min) != 2)
 		return "Invalid time set, should be HH:MM";
+	if (st->tm.tm_hour > 23 || st->tm.tm_min > 59 || st->tm.tm_hour < 0 || st->tm.tm_min < 0)
+		return "Invalid time set.";
 	st->enable = true;
 	return NULL;
 }