mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-04 12:52:15 +00:00
Add error and range checking to strtoul() to avoid ending up with a
delay time of ULONG_MAX when -I is passed a non-numeric arg.
This commit is contained in:
parent
86b81cd948
commit
4fe8c1b67b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112487
@ -75,7 +75,8 @@ main(int argc, char **argv)
|
||||
case 'I':
|
||||
p = NULL;
|
||||
i = strtoul(optarg, &p, 0);
|
||||
if (p == optarg) {
|
||||
if (p == optarg || errno == EINVAL ||
|
||||
errno == ERANGE) {
|
||||
errx(1, "Invalid argument to -I");
|
||||
} else if (!strcmp(p, "s"))
|
||||
i *= 1000000;
|
||||
|
Loading…
Reference in New Issue
Block a user