]> xenbits.xensource.com Git - people/liuw/freebsd.git/commitdiff
timeout(1): fix the acceptable range values for parse_signal()
authorbapt <bapt@FreeBSD.org>
Sat, 24 Oct 2015 13:47:03 +0000 (13:47 +0000)
committerbapt <bapt@FreeBSD.org>
Sat, 24 Oct 2015 13:47:03 +0000 (13:47 +0000)
Before both 0 and sys_nsig would be successfully returned by parse_signal()
although being invalid signal numbers.

PR: Alexandre Perrin <alex@kaworu.ch>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3990

usr.bin/timeout/timeout.c

index a682dde191644585edb75e2258e4dfcaedcc7a65..804efd8131f6bbaca77dd9ce0b5f0fda363ebd26 100644 (file)
@@ -105,7 +105,7 @@ parse_signal(const char *str)
        int sig, i;
        const char *errstr;
 
-       sig = strtonum(str, 0, sys_nsig, &errstr);
+       sig = strtonum(str, 1, sys_nsig - 1, &errstr);
 
        if (errstr == NULL)
                return (sig);