]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Check for zero argc in ksu 769/head
authorGreg Hudson <ghudson@mit.edu>
Tue, 24 Apr 2018 18:31:35 +0000 (14:31 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 24 Apr 2018 18:31:35 +0000 (14:31 -0400)
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

src/clients/ksu/main.c

index 7ff676ca728b3c4df468fcc998cb5bd3451afa0b..5e79ef5f423a3514452bd06b2af36bb4d512e20b 100644 (file)
@@ -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];