Re: [PATCH v3 0/4] Make sscanf() stricter

Demi Marie Obenour
2023-06-13T15:35:27Z

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On Tue, Jun 13, 2023 at 01:02:59PM +0000, David Laight wrote:
> From: Demi Marie Obenour
> > Sent: 12 June 2023 22:23
> ....
> > sscanf(), except to the extent that -Werror=format can keep working.
> > Userspace sscanf() is almost useless: it has undefined behavior on
> > integer overflow and swallows spaces that should usually be rejected.
>
> scanf() is designed for parsing space separated data.
> Eating spaces it part of its job description.
>
> David

In this case I would prefer to have two versions: one that eats spaces
and one that does not. For instance, I don’t think any user of
xenbus_scanf() wants the space-swallowing behavior. This can be worked
around in xenbus_scanf(), of course, by having it reject strings with
spaces (as determened by isspace()) before calling vsscanf().
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]