diff mbox

[03/47] dumpe2fs: don't crash when the user provides no block device argument

Message ID 20141107215102.883.8882.stgit@birch.djwong.org
State Accepted, archived
Headers show

Commit Message

Darrick Wong Nov. 7, 2014, 9:51 p.m. UTC
If the user doesn't provide any arguments, the guard fails to run and
the whole thing segfaults on ext2fs_open2().  Don't do that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/dumpe2fs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o Nov. 8, 2014, 2:26 a.m. UTC | #1
On Fri, Nov 07, 2014 at 01:51:02PM -0800, Darrick J. Wong wrote:
> If the user doesn't provide any arguments, the guard fails to run and
> the whole thing segfaults on ext2fs_open2().  Don't do that.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index e565f2d..26f2e37 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -656,7 +656,7 @@  int main (int argc, char ** argv)
 			usage();
 		}
 	}
-	if (argc - 1 > optind) {
+	if (optind != argc - 1) {
 		usage();
 		exit(1);
 	}