]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: fix null pointer deref when complaining about scrub command
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 31 May 2018 19:09:55 +0000 (14:09 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 31 May 2018 19:09:55 +0000 (14:09 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/scrub.c

index cd2699741b0a8d4040f0b87deaac58d9e6159700..75a8ff158b9ef5f1c795420a7ec08d1de977649b 100644 (file)
@@ -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: