Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8815116
)
util: avoid off-by-one on long symlinks
author
Tobias Stoeckmann
<tobias@stoeckmann.org>
Mon, 20 Jul 2015 14:42:40 +0000
(10:42 -0400)
committer
Theodore Ts'o
<tytso@mit.edu>
Wed, 22 Jul 2015 04:17:07 +0000
(
00:17
-0400)
readlink does not nul terminate its result, therefore one extra byte
has to be taken into account.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
util/symlinks.c
patch
|
blob
|
history
diff --git
a/util/symlinks.c
b/util/symlinks.c
index
abb33f8
..
3acebe7
100644
(file)
--- a/
util/symlinks.c
+++ b/
util/symlinks.c
@@
-166,7
+166,7
@@
static void fix_symlink (char *path, dev_t my_dev)
struct stat stbuf, lstbuf;
int c, fix_abs = 0, fix_messy = 0, fix_long = 0;
- if ((c = readlink(path, lpath, sizeof(lpath))) == -1) {
+ if ((c = readlink(path, lpath, sizeof(lpath)
- 1
)) == -1) {
perror(path);
return;
}