Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
crash in httpGetHostname() #1561
An user just reported a crash with 1.2rc2 test packages, with the following backtrace: http://kubuntu.pastebin.com/657295
Sorry, it's relatively poor due to no debug symbols. I'll try to have him reproduce the issue. However, in the meantime I added some robustification to httpGetHostname() so that crashes are less likely. They might not fix the crash, but the additional checks can't hurt anyway IMHO.
CUPS.org User: mike
OK, I'm attaching the patch I've applied in r5399.
To summarize: http->hostname is a character array - it cannot be NULL. I added a check for the s and slen arguments, and a check for the gethostname() return value, and finally to make sure that h_name in the hostent structure is not NULL.
diff -urNad cups-1.2~/cups/http-addr.c cups-1.2/cups/http-addr.c
if (!strchr(s, '.'))
--- http-addr.c (revision 5398)