Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH} Re: I think I found a serious bug in zstrtoul_underscore
On 11/6/22, Clinton Bunch <cdbunch@xxxxxxxxxxx> wrote:
> I see now my mistake in the options segment of bintab, ":%" specifies an
> *optional* numeric argument. Removing the % makes it fail correctly.
> Which leads to the question why would there be an optional numeric
> argument specification, but not a mandatory numeric argument specification?
>
> Though it did uncover a pathological case that caused a catastrophic
> failure in zstrtoul_underscore. It doesn't check that s is null before
> it starts trying to convert. I've attached the trivial patch.
If we did this, it would make more sense to add the check in
zstrtol_underscore which has more than one current user, however it is
expected that functions like this crash on NULL, the standard library
strtol (and most other str*) does this as well.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author