]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()
authorThomas Weißschuh <thomas@t-8ch.de>
Wed, 12 Jun 2024 21:32:15 +0000 (23:32 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 27 Jun 2024 10:10:35 +0000 (12:10 +0200)
commite5b6670c00c3b53beed1f2cec71f3d1616ea345e
tree46115007a365a97be59287e538bd38281a25dfbd
parent6b7f1410367052f2a0e7c65ebb7c2a80e2667e33
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()

sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.

Now it's also valid for sz and bufsz to be equal.

See #3088.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit 24e3ede3dab15fcbf18d16ac09ae57ba4827c4b5)
lib/sysfs.c