]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: Avoid strlen if only first char is checked
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 3 Oct 2016 20:05:03 +0000 (22:05 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 6 Oct 2016 12:56:39 +0000 (14:56 +0200)
commite8c20678f3700105ea9299ad481ce3d70419bb9e
treeac28008b4628ebcadaf424279f5df877bd4cabe7
parentc39447445c12a21a85e42bc8dd7d70091298349d
libblkid: Avoid strlen if only first char is checked

A strlen() call can lead to out of boundary read access if the
superblock in question has no nul-bytes after the string. This
could be avoided by using strnlen() but the calls in question
merely existed to check if the string length is not 0.

By changing the calls as proposed with this diff, these files are
in sync with other superblock files, which do exactly the same.
libblkid/src/superblocks/befs.c
libblkid/src/superblocks/ext.c
libblkid/src/superblocks/jfs.c
libblkid/src/superblocks/nilfs.c
libblkid/src/superblocks/romfs.c
libblkid/src/superblocks/xfs.c