From 9b45f6bb68f23d95841a90a226e9e36cb635def2 Mon Sep 17 00:00:00 2001 From: Aditya Deshpande Date: Fri, 3 Feb 2023 16:15:30 +0000 Subject: [PATCH] Fix more argc checks Signed-off-by: Aditya Deshpande --- programs/hash/generic_sum.c | 2 +- programs/test/query_compile_time_config.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/hash/generic_sum.c b/programs/hash/generic_sum.c index e2e49e343..995694af0 100644 --- a/programs/hash/generic_sum.c +++ b/programs/hash/generic_sum.c @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) mbedtls_md_init(&md_ctx); - if (argc == 1) { + if (argc < 2) { const int *list; mbedtls_printf("print mode: generic_sum ...\n"); diff --git a/programs/test/query_compile_time_config.c b/programs/test/query_compile_time_config.c index 8f763facd..df0fe4a70 100644 --- a/programs/test/query_compile_time_config.c +++ b/programs/test/query_compile_time_config.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { int i; - if (argc == 1 || strcmp(argv[1], "-h") == 0) { + if (argc < 2 || strcmp(argv[1], "-h") == 0) { mbedtls_printf(USAGE, argv[0]); return MBEDTLS_EXIT_FAILURE; }