Subject: Re: bin/6456: modload && atoi
To: None <netbsd-bugs@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 11/18/1998 11:25:31
In article <199811181009.LAA14841@natt.e.kth.se> lha@stacken.kth.se writes:
>- modnum = atoi(optarg);
>+ modnum = strtol(optarg, &endptr, 0);
>+ if (*endptr != '\0')
>+ errx(1, "not a valid number");
> break; /* number */
> case 'n':
> modname = optarg;
It is not enough to check strtol's endptr. You need to check the result
for LONG_MIN and LONG_MAX and ERANGE.
christos