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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Jeffrey Arbuckle via RT
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



_______________________________________________
krb5-bugs mailing list
[hidden email]
https://mailman.mit.edu/mailman/listinfo/krb5-bugs