linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Do not return more items that user asked from from search ioctl
@ 2010-08-20 21:40 Jan Kara
  0 siblings, 0 replies; only message in thread
From: Jan Kara @ 2010-08-20 21:40 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-btrfs, Jan Kara

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 <jack@suse.cz>
---
 fs/btrfs/ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 9254b3d..94e7ab5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -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:
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-20 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20 21:40 [PATCH] btrfs: Do not return more items that user asked from from search ioctl Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).