]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-util: bound leading whitespace skip in udev_replace_whitespace (#42757)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 16 Jul 2026 16:16:07 +0000 (01:16 +0900)
committerGitHub <noreply@github.com>
Thu, 16 Jul 2026 16:16:07 +0000 (01:16 +0900)
udev_replace_whitespace() is documented to read at most 'len' bytes from
'str':
- the strspn() skip of leading whitespace stops at a non-space byte or
NUL, not at 'len'
- ata_id passes the space padded, non-NUL-terminated ATA IDENTIFY
model/serial/fw fields
- an all-blank field reads off the end of the 512-byte hd_driveid stack
struct
Capped the skip to 'len'; existing outputs are unchanged. Added a
regression test.

1  2 
src/basic/string-util.c
src/basic/string-util.h
src/test/test-string-util.c

Simple merge
Simple merge
Simple merge