commit ad68edeea77f6ba2ae839685cd449597b7ee5467 parent caad43cde564123b541df3cb2652df55937ac45f Author: Claudio Alessi <smoppy@gmail.com> Date: Sat, 28 May 2022 17:37:00 +0200 Prevent int overflow in time_to_sec() Diffstat:
M | snore.c | | | 2 | ++ |
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/snore.c b/snore.c @@ -73,6 +73,8 @@ time_to_sec(char *s) { for(j = 0; j < LENGTH(symbols); ++j) { if(s[0] == symbols[j].sym) { part *= symbols[j].mult; + if(part >= UINT_MAX) + return -1; s++; break; }