Maintained by: NLnet Labs

[Unbound-users] Segfault on user not found with 1.5.3

W.C.A. Wijngaards
Mon Mar 23 21:21:30 CET 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Maciej,

On 03/23/2015 06:04 PM, Maciej Soltysiak wrote:
> 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
> :-)

Thank you for the report, applied it by setting checks on the success
of that lookup and continuing with the error printed.

Best regards,
   Wouter

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJVEHXKAAoJEJ9vHC1+BF+NFpQP/i2cFS9hS5OBhQ5aZOMa8s6Q
b+x0C9FdEOROx3jK/37NmGtW2AxtaEvYCnEQcSD9MGSLMjHIC7UClbcMdmLq9oFg
o0PwuxNeyb4/GuD/+UsRCn4cSP4idACKMU2/iMIR0ufw/zgv2QVR2E7TlkN4zA9n
mbz4BCKRLmfGuPKaDx6uXg63u2XtqGDRUyb/ZKQgY0UAAyRz/HjyyBEYJRE9d+OU
wbe4OM6VirCSx+Zw4cO2guSSd7Hx9+5v6OE4fYjVCphe5ORqGGMHnqQVysstrJw9
8lGT0ySWr1XzpfUiOSa9AdS7Umj403foKwNBIgGzsSbhtaPaAIk/9kV5A8wkSuQ6
a7MM16rfV68DJUmBcXGBEG/+J60F6J75APDETc/htjlPa5VjzFjyJMYLgECf1FiX
UycjJZ6KcFycjIFygy+c8Vf361Uh8Etw1QPNy/SvxvK2qjG9UceNsX3R0zbCtt2U
JZMeOrLJarEVYoz1sYC9BJiaModr0rmHJXNDHf3EYWbIvIx7ps311Xsgqflmwov7
vtftA6ehfKApNM63wt9l91lngnbXayThZ885bxm1aNgCfpCQRpvoweDrdNSc4kZP
Qn0/cuQDwX+InSN+usmjVONAu5tLP99cKQM30tLl62sCJsj/qzSVsNTuX+h8W36T
zMdEQiJU4dOSHLsioOLo
=1f2l
-----END PGP SIGNATURE-----