From 4d988b1c2f457388aa69fe61b7a3e213ced6a12e Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Thu, 27 Jan 2022 09:04:41 +0100 Subject: [PATCH] Stops if argc <= 0 --- src/phmain.c | 2 ++ src/testdisk.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/phmain.c b/src/phmain.c index 230db573..9e622ed1 100644 --- a/src/phmain.c +++ b/src/phmain.c @@ -168,6 +168,8 @@ int main( int argc, char **argv ) .list_file_format=array_file_enable }; struct ph_param params; + if(argc <= 0) + return 1; params.recup_dir=NULL; params.cmd_device=NULL; params.cmd_run=NULL; diff --git a/src/testdisk.c b/src/testdisk.c index 6c4b8ac7..acbfb858 100644 --- a/src/testdisk.c +++ b/src/testdisk.c @@ -233,6 +233,8 @@ int main( int argc, char **argv ) const char *logfile="testdisk.log"; int log_opened=0; int log_errno=0; + if(argc <= 0) + return 1; /* srand needed for GPT creation (weak is ok) */ srand(time(NULL)); #ifdef HAVE_SIGACTION