]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev-util: bound leading whitespace skip in udev_replace_whitespace 42757/head
authorSyed Mohammed Nayyar <jmestwa@gmail.com>
Mon, 29 Jun 2026 06:02:14 +0000 (11:32 +0530)
committerSyed Mohammed Nayyar <jmestwa@gmail.com>
Thu, 16 Jul 2026 10:23:37 +0000 (15:53 +0530)
commit6b2cb3abebf989adb58720efc8feb6bee8328f45
tree00c14907faf6758ce70133510c7c1a6906905623
parent0af6caff42b53dbf740cc08ca77aab31ec405284
udev-util: bound leading whitespace skip in udev_replace_whitespace

The function documents that at most 'len' bytes are read from 'str',
but the leading whitespace skip used strspn(), which is bounded only
by a non-whitespace byte or a NUL. ata_id passes the space padded,
non-NUL-terminated ATA IDENTIFY fields, so an all-blank model reads
past the buffer. Use strnspn() to cap the skip to 'len'.
src/shared/udev-util.c
src/test/test-udev-util.c