btrfs: Do not return more items that user asked from from search ioctl
PATCH 1/1 btrfs: Do not return more items that user asked from from search ioctl
While searching a tree we didn't properly check number of items we really stored in user's buffer thus possibly exceeding number of items requested by user. This was mostly harmless since actual buffer overflow is checked correctly in a different place. Anyway, let's fix the check.
Signed-off-by Jan Kara <[email protected]>
--- fs/btrfs/ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/ioctl.c +1 -1
@@ -977,7 +977,7 @@ static noinline int copy_to_sk(struct btrfs_root *root, } found++; -if (*num_found >= sk->nr_items) +if (*num_found + found >= sk->nr_items)break ; } advance_key:
Signature · 1 line
1.6.4.2