Maciej Soltysiak
2015-03-23 17:04:39 UTC
Hi,
I just took the latest 1.5.3, compiled it and ran the executable without
doing any config. Just to see what happens.
It segfaulted after saying user unbound not found.
The issue is in util/config_file.c in function config_lookup_uid().
getpwnam() can return NULL and so subsequent referrences to pw_uid and
pw_gid are invalid.
This patch corrects the code path to assign uid and gid only if getpwnam()
is successful.
It also removes the log_err() call, because perform_setup() in
daemon/unbound.c would print it anyway in fatal_exit()
I know it's a tiny buglet, but I couldn't resist fixing a segfault :-)
Best regards,
Maciej Soltysiak
DNSCrypt Poland
https://dnscrypt.pl/
I just took the latest 1.5.3, compiled it and ran the executable without
doing any config. Just to see what happens.
It segfaulted after saying user unbound not found.
The issue is in util/config_file.c in function config_lookup_uid().
getpwnam() can return NULL and so subsequent referrences to pw_uid and
pw_gid are invalid.
This patch corrects the code path to assign uid and gid only if getpwnam()
is successful.
It also removes the log_err() call, because perform_setup() in
daemon/unbound.c would print it anyway in fatal_exit()
I know it's a tiny buglet, but I couldn't resist fixing a segfault :-)
Best regards,
Maciej Soltysiak
DNSCrypt Poland
https://dnscrypt.pl/