From: | Erik Sjölund <erik.sjolund@gmail.com> |
Date: | Sun, 1 Apr 2018 16:22:19 +0200 |
Subject: | ksu segfaults when argc == 0 |
To: | krb5-bugs@mit.edu |
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@laptop:/tmp$ cat /etc/issue
Ubuntu 17.10 \n \l
user@laptop:/tmp$ cat main.cc
#include <unistd.h>
int main() {
char* arr[] = {nullptr};
execv("/usr/bin/ksu", arr);
}
user@laptop:/tmp$ g++ -std=c++11 -o /tmp/start main.cc
user@laptop:/tmp$ /tmp/start
Segmentation fault (core dumped)
user@laptop:/tmp$
Best regards,
Erik Sjölund
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@laptop:/tmp$ cat /etc/issue
Ubuntu 17.10 \n \l
user@laptop:/tmp$ cat main.cc
#include <unistd.h>
int main() {
char* arr[] = {nullptr};
execv("/usr/bin/ksu", arr);
}
user@laptop:/tmp$ g++ -std=c++11 -o /tmp/start main.cc
user@laptop:/tmp$ /tmp/start
Segmentation fault (core dumped)
user@laptop:/tmp$
Best regards,
Erik Sjölund