diff --git a/Makefile b/Makefile index 8b0433a6..a30fac65 100644 --- a/Makefile +++ b/Makefile @@ -245,6 +245,9 @@ test32: xxhsum32 TEST_FILES = xxhsum$(EXT) xxhash.c xxhash.h .PHONY: test-xxhsum-c test-xxhsum-c: xxhsum + # --seed requires a value + ./xxhsum --seed 2>&1 | $(GREP) -q "^Wrong parameters" + ./xxhsum -H0 --seed 2>&1 | $(GREP) -q "^Wrong parameters" # xxhsum to/from pipe ./xxhsum $(TEST_FILES) | ./xxhsum -c - ./xxhsum -H0 $(TEST_FILES) | ./xxhsum -c - diff --git a/cli/xxhsum.c b/cli/xxhsum.c index f8e43c08..154e7577 100644 --- a/cli/xxhsum.c +++ b/cli/xxhsum.c @@ -1615,6 +1615,7 @@ XSUM_API int XSUM_main(int argc, const char* argv[]) if (!strcmp(argument, "--seed") ){ const char* seed_str; i++; + if (i >= argc) return XSUM_badusage(exename); seed_str = argv[i]; switch( algo ){ case algo_xxh32 : g_default_seed_u32 = XSUM_readU32FromChar(&seed_str); break;