From: Greg Hudson Date: Tue, 24 Apr 2018 18:31:35 +0000 (-0400) Subject: Check for zero argc in ksu X-Git-Tag: krb5-1.17-beta1~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5b0a998d6349f8c90821a347db5666aed0e50eb;p=thirdparty%2Fkrb5.git Check for zero argc in ksu Most programs in the tree will perform a null dereference when argc is zero, but as a setuid program ksu should be extra careful about memory errors, even if this one is harmless. Check and exit with status 1 immediately. ticket: 8661 --- diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c index 7ff676ca72..5e79ef5f42 100644 --- a/src/clients/ksu/main.c +++ b/src/clients/ksu/main.c @@ -138,6 +138,8 @@ main (argc, argv) exit(1); } + if (argc == 0) + exit(1); if (strrchr(argv[0], '/')) argv[0] = strrchr(argv[0], '/')+1; prog_name = argv[0];