[Libguestfs] RFC: *scanf vs. overflow

Paul Eggert eggert at cs.ucla.edu
Sat May 23 03:06:34 UTC 2020


On 5/22/20 6:16 PM, Rich Felker wrote:
> A new feature
> will not reliably be usable for decades in portable software, but new
> documentation of existing universal practice would be immediately
> usable.

We could do both.

Also, we could change glibc's behavior in a simpler way, by not adding a new
flag; but if an integer is out of range, then scan only the initial prefix that
fits, leaving the trailing digits for the rest of the format to scan. This also
conforms to POSIX and is more likely to cause C programs to do the right thing
(i.e., report a failure) than the current behavior does. And with luck perhaps
we could eventually get POSIX to standardize this behavior.




More information about the Libguestfs mailing list