diff options
author | Karel Zak | 2012-10-23 12:40:39 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-23 12:40:39 +0200 |
commit | 9f51089e7f14f9b6f432a20ca59c0db5e5f16325 (patch) | |
tree | 85b04f0899cc474ba7ec3a97dcf620ce3f22ee63 /sys-utils/eject.c | |
parent | lsblk: use new sysfs functions, clean up get_transport() (diff) | |
download | kernel-qcow2-util-linux-9f51089e7f14f9b6f432a20ca59c0db5e5f16325.tar.gz kernel-qcow2-util-linux-9f51089e7f14f9b6f432a20ca59c0db5e5f16325.tar.xz kernel-qcow2-util-linux-9f51089e7f14f9b6f432a20ca59c0db5e5f16325.zip |
misc: make readlink() usage more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/eject.c')
-rw-r--r-- | sys-utils/eject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys-utils/eject.c b/sys-utils/eject.c index 5d5d7b18b..e28837155 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -837,7 +837,7 @@ static char *get_subsystem(char *chain, char *buf, size_t bufsz) memcpy(chain + len, SUBSYSTEM_LINKNAME, sizeof(SUBSYSTEM_LINKNAME)); /* try if subsystem symlink exists */ - sz = readlink(chain, buf, bufsz); + sz = readlink(chain, buf, bufsz - 1); /* remove last subsystem from chain */ chain[len] = '\0'; |