wmppp.app: Fix segfault when HOME undefined.

Instead, we exit with an error message.

This fixes Debian bug #716472 [1].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=716472
This commit is contained in:
Doug Torrance 2015-05-19 22:31:06 -05:00 committed by Carlos R. Mafra
parent 7631c7d566
commit 37acf2a687

View file

@ -422,6 +422,11 @@ void wmppp_routine(int argc, char **argv) {
parse_rcfile(temp, wmppp_keys); parse_rcfile(temp, wmppp_keys);
p = getenv("HOME"); p = getenv("HOME");
if (p == NULL) {
fprintf(stderr,
"error: HOME environment variable not defined\n");
exit(EXIT_FAILURE);
}
strcpy(temp, p); strcpy(temp, p);
strcat(temp, "/.wmppprc"); strcat(temp, "/.wmppprc");
parse_rcfile(temp, wmppp_keys); parse_rcfile(temp, wmppp_keys);