Commit ed7389e87ed6861fc674a63ee43d38276fa2f9dd

Con Kolivas 2011-09-02T08:35:27

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

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/main.c b/main.c
index 5ca38b5..71e66a8 100644
--- a/main.c
+++ b/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;
 }