From: Darrick J. Wong Date: Thu, 31 May 2018 19:09:55 +0000 (-0500) Subject: xfs_io: fix null pointer deref when complaining about scrub command X-Git-Tag: v4.17.0-rc1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7856ed05cb0e0b00836456541b641b5b59e36fe3;p=thirdparty%2Fxfsprogs-dev.git xfs_io: fix null pointer deref when complaining about scrub command Don't increment optind until we've validated that argv[optind] is a valid scrub/repair subcommand and do not need to complain about argv[optind]. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell Signed-off-by: Eric Sandeen --- diff --git a/io/scrub.c b/io/scrub.c index cd2699741..75a8ff158 100644 --- a/io/scrub.c +++ b/io/scrub.c @@ -164,12 +164,11 @@ parse_args( break; } } - optind++; - if (type < 0) { printf(_("Unknown type '%s'.\n"), argv[optind]); return command_usage(cmdinfo); } + optind++; switch (d->type) { case ST_INODE: