libblkid-tiny: fix buffer overflow
authorDaniel Golle <daniel@makrotopia.org>
Wed, 12 May 2021 16:07:28 +0000 (17:07 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sat, 15 May 2021 23:28:11 +0000 (00:28 +0100)
commitd47909ea1e5f32cfc9f756a04edc052717c98ae6
tree8168ec79828109aeb216563c353ad2ae9b02d0fa
parent6d8450e9ffac42fca34df8972c5379821bf65eff
libblkid-tiny: fix buffer overflow

Copying device name into a fixed-length buffer is problematic as
the name can be longer than the buffer, resulting in subsequent fields
getting corrupted and potentially even worse things.
Drop strcpy of device name and use of the copied value as it is known
anyway.

Before this fix:
/dev/mapper/owrt--volumes--e093cc66-rw_test: UUID="c66-rw_test" LABEL="test" VERSION="1.14" TYPE="f2fs"

After this fix:
/dev/mapper/owrt--volumes--e093cc66-rw_test: UUID="5eda3e52-3427-493a-a6d6-ffdb5a5836fd" LABEL="test" VERSION="1.14" TYPE="f2fs"

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libblkid-tiny/libblkid-tiny.c
probe.c