[krbdev.mit.edu #8661] ksu segfaults when argc == 0

Erik Sjölund via RT rt-comment at KRBDEV-PROD-APP-1.mit.edu
Sun Apr 1 13:11:21 EDT 2018


Programs are generally started with argc >= 1,
but it is possible to start a program with an
empty argv (i.e. argc == 0).

Current behaviour:
ksu segfaults when started with argc == 0.

Expected behaviour:
I would expect ksu to just exit with an error
instead.

Here is a demonstration of the segmentation fault:

user at laptop:/tmp$ cat /etc/issue
Ubuntu 17.10 \n \l

user at laptop:/tmp$ cat main.cc
#include <unistd.h>
int main() {
  char* arr[] = {nullptr};
  execv("/usr/bin/ksu", arr);
}
user at laptop:/tmp$ g++ -std=c++11 -o /tmp/start main.cc
user at laptop:/tmp$ /tmp/start
Segmentation fault (core dumped)
user at laptop:/tmp$

Best regards,
Erik Sjölund




More information about the krb5-bugs mailing list