mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
fs: Fix improper use of readlink
readlink returns a non-NUL terminated buffer. If we are going to terminate its response, we need to make sure that there's space to do so. So the length passed to readlink should be one less than the real length of the buffer. This is a 1.6-only change It is inspired by commit 25011b4544e48dffd5978201669f7b9e23da3144 which cannot be cherry picked due to other missing commits on the 1.6 branch, like 763ec5250deef6f0f8ae1c85b52bac3ffc1a6176. Change-Id: I5c3f2946f7c1b8e935ae46bc195f58e207e115d6 Reviewed-on: http://gerrit.openafs.org/11054 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: D Brashear <shadow@your-file-system.com> Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
parent
d08e048e57
commit
9e22709491
@ -1742,7 +1742,7 @@ ListMountCmd(struct cmd_syndesc *as, void *arock)
|
||||
/*
|
||||
* Read name of resolved file.
|
||||
*/
|
||||
link_chars_read = readlink(orig_name, true_name, 1024);
|
||||
link_chars_read = readlink(orig_name, true_name, 1024 - 1);
|
||||
if (link_chars_read <= 0) {
|
||||
fprintf(stderr,
|
||||
"%s: Can't read target name for '%s' symbolic link!\n",
|
||||
@ -4129,7 +4129,7 @@ FlushMountCmd(struct cmd_syndesc *as, void *arock)
|
||||
/*
|
||||
* Read name of resolved file.
|
||||
*/
|
||||
link_chars_read = readlink(orig_name, true_name, 1024);
|
||||
link_chars_read = readlink(orig_name, true_name, 1024 - 1);
|
||||
if (link_chars_read <= 0) {
|
||||
fprintf(stderr,
|
||||
"%s: Can't read target name for '%s' symbolic link!\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user