summaryrefslogtreecommitdiff
path: root/cmds-restore.c
diff options
context:
space:
mode:
authorVincent Stehlé <vincent.stehle@freescale.com>2015-10-08 10:47:09 +0200
committerDavid Sterba <dsterba@suse.com>2015-10-16 19:37:44 +0200
commitb585f03da47add466d21dd51d0623276ddb13411 (patch)
treef94da1b3588537cc4603eb80b705f75baee836eb /cmds-restore.c
parentd3be5b65dab602104829379144b22426f6b08206 (diff)
btrfs-progs: restore: fix off-by-one len check
Fix a check of len versus PATH_MAX in function copy_symlink(), to account for the terminating null byte. Resolves-Coverity-CID: 1296749 Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-restore.c')
-rw-r--r--cmds-restore.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-restore.c b/cmds-restore.c
index 8fc8b2a0..a1445d4d 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -863,7 +863,7 @@ static int copy_symlink(struct btrfs_root *root, struct btrfs_key *key,
len = btrfs_file_extent_inline_item_len(leaf,
btrfs_item_nr(path->slots[0]));
- if (len > PATH_MAX) {
+ if (len >= PATH_MAX) {
fprintf(stderr, "Symlink '%s' target length %d is longer than PATH_MAX\n",
fs_name, len);
ret = -1;