]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/path: improve ul_path_readlink() to be more robust
authorKarel Zak <kzak@redhat.com>
Thu, 17 Jun 2021 11:28:32 +0000 (13:28 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Jun 2021 11:28:32 +0000 (13:28 +0200)
commit9dbae34c3da7667319df2191b4b0fee6552dd0e3
tree84008792720ae4e5e6439de525998c2a34f8cd4e
parent2384fa6e4d086656ea7ae890d2ac2bdce08ca0e6
lib/path: improve ul_path_readlink() to be more robust

According to POSIX, readlink() makes no effort to null-terminate buffer
with the result. It seems better to hide this disadvantage in the
ul_path_...() API rather than assume buf[sz] = '\0' everywhere.

Reported-by: Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path.c
lib/sysfs.c