Re: [PATCH v2 2/5] parse-options: introduce precision handling for `OPTION_INTEGER`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 15, 2025 at 04:51:59PM +0100, Phillip Wood wrote:
> On 15/04/2025 13:14, Patrick Steinhardt wrote:
> > Note that we do not yet assert signedness of the passed variable, which
> > is another source of bugs. This will be handled in a subsequent commit.
> > 
> > +		} else {
> > +			value = strtoimax(arg, (char **)&s, 10);
> > +			if (*s)
> > +				return error(_("%s expects a numerical value"),
> > +					     optname(opt, flags));
> 
> To catch overflow errors for arguments of intimax_t we need to do
> 
> 	errno = 0
> 	value = strtoimax(arg, (Char **)&s, 10);
> 	if (errno || *s)
> 		return error(...)
> 
> to catch the error when we parse the string as the checks below only work
> for narrower types.

Fair. This issue isn't new -- it already existed before my patch series.
But that's not a good enough reason to not fix it while we're at it.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux