commit 962f4eded6effdc8474928ec02e3ca9e33ed753f
parent a156a190c5277a05887fbe33cfcb03eddfe450ea
Author: Claudio Alessi <smoppy@gmail.com>
Date: Mon, 10 Jul 2017 23:55:48 +0200
Fix SIGSEGV with large time values.
This is a quick and dirty fix, it's likely there is a better way to go.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/snore.c b/snore.c
@@ -1,5 +1,6 @@
/* See LICENSE for license details. */
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -112,6 +113,8 @@ main(int argc, char *argv[]) {
if(tm < 0)
die("%s: wrong time\n", argv[i]);
endtm += tm;
+ if(endtm >= UINT_MAX)
+ die("%s: time too large\n", argv[0]);
}
if(!endtm)
endtm = symbols[LENGTH(symbols) - 1].mult;