From b585f03da47add466d21dd51d0623276ddb13411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Thu, 8 Oct 2015 10:47:09 +0200 Subject: [PATCH] btrfs-progs: restore: fix off-by-one len check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: David Sterba --- cmds-restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;