From: Eric Sandeen Date: Mon, 14 Apr 2014 06:13:47 +0000 (+1000) Subject: xfs_db: don't use invalid index in ring_f X-Git-Tag: v3.2.0-rc1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d15f7cfb767b77a9c02977af8c6b03d1bfc883d0;p=thirdparty%2Fxfsprogs-dev.git xfs_db: don't use invalid index in ring_f ring_f() tests for an invalid index which would overrun the iocur_ring[] array and warns, but then uses it anyway. Return immediately if it's out of bounds. Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/db/io.c b/db/io.c index 89e60305b..5eb61d920 100644 --- a/db/io.c +++ b/db/io.c @@ -358,8 +358,10 @@ ring_f( } index = (int)strtoul(argv[1], NULL, 0); - if (index < 0 || index >= RING_ENTRIES) + if (index < 0 || index >= RING_ENTRIES) { dbprintf(_("invalid entry: %d\n"), index); + return 0; + } ring_current = index;