From: Jeremy Harris Date: Sat, 29 Jan 2022 12:39:42 +0000 (+0000) Subject: Avoid null-indirection from null argv[0] X-Git-Tag: exim-4.96-RC0~87 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/10d0e7206d88d1fb811b01e49181187579f77e9c Avoid null-indirection from null argv[0] --- diff --git a/src/src/exim.c b/src/src/exim.c index de25b3256..c35049763 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -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