btrfs-progs: btrfs-crc: make argc check more strict
authorSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Thu, 2 Jun 2016 08:14:57 +0000 (17:14 +0900)
committerDavid Sterba <dsterba@suse.com>
Fri, 3 Jun 2016 12:49:43 +0000 (14:49 +0200)
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-crc.c

index 27244d785152a994b2fbc2135d79fb4944d17ffd..c3e4774766b7ab5937a3812766ed86d845487ebc 100644 (file)
@@ -69,12 +69,14 @@ int main(int argc, char **argv)
        str = argv[optind];
 
        if (!loop) {
-               if (check_argc_min(argc - optind, 1))
+               if (check_argc_exact(argc - optind, 1))
                        print_usage(255);
 
                printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str);
                return 0;
        }
+       if (check_argc_exact(argc - optind, 0))
+               print_usage(255);
 
        buf = malloc(length);
        if (!buf)