Avoid null-indirection from null argv[0]
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 29 Jan 2022 12:39:42 +0000 (12:39 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 29 Jan 2022 12:45:03 +0000 (12:45 +0000)
src/src/exim.c

index de25b325659b27fd2753770d04561f19fde8d8cf..c35049763050795b3767c131a9ddfcdf97810380 100644 (file)
@@ -1690,7 +1690,7 @@ int  i, rv;
 int  list_queue_option = 0;
 int  msg_action = 0;
 int  msg_action_arg = -1;
-int  namelen = (argv[0] == NULL)? 0 : Ustrlen(argv[0]);
+int  namelen = argv[0] ? Ustrlen(argv[0]) : 0;
 int  queue_only_reason = 0;
 #ifdef EXIM_PERL
 int  perl_start_option = 0;
@@ -1834,6 +1834,7 @@ if (f.running_in_test_harness)
   debug_store = TRUE;
 
 /* Protect against abusive argv[0] */
+if (!argv[0] || !argc) exim_fail("exim: executable name required\n");
 exim_str_fail_toolong(argv[0], PATH_MAX, "argv[0]");
 
 /* The C standard says that the equivalent of setlocale(LC_ALL, "C") is obeyed