From: dlg Date: Thu, 20 Apr 2017 03:04:11 +0000 (+0000) Subject: use strtonum instead of strtoll to parse the argument to -j X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bdbd5f40efd2dc807578b331c464b1d369beee2e;p=openbsd use strtonum instead of strtoll to parse the argument to -j ok deraadt@ benno@ --- diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index b5d2f1894dc..4412e9acb43 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.121 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: main.c,v 1.122 2017/04/20 03:04:11 dlg Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -310,14 +310,14 @@ MainParseArgs(int argc, char **argv) Lst_AtEnd(&makefiles, optarg); break; case 'j': { - char *endptr; + const char *errstr; forceJobs = true; - maxJobs = strtol(optarg, &endptr, 0); - if (endptr == optarg) { + maxJobs = strtonum(optarg, 1, INT_MAX, &errstr); + if (errstr != NULL) { fprintf(stderr, - "make: illegal argument to -j option -- %s -- not a number\n", - optarg); + "make: illegal argument to -j option" + " -- %s -- %s\n", optarg, errstr); usage(); } record_option(c, optarg);