You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jan Kaluža <jk...@redhat.com> on 2013/05/02 09:01:46 UTC

[PATCH] unix/sockaddr.c: return error when call_resolver fails and *sa is 0

Hi,

attached patch (against 1.4.6, but works with trunk too) fixes two 
problems I have found in call_resolver function.

1. For unknown reason (probably getaddrinfo bug), getaddrinfo returns 
error EAI_SYSTEM, but errno is set to 0. In this case, we return 0 
(APR_SUCCESS) from call_resolver even when this function failed. This 
leads to httpd crash later, because *sa is NULL, but we return APR_SUCCESS.

Attached patch fixes it by returning APR_EGENERAL in this case.

I was not able to reproduce it myself, but it happens for one Fedora 
user [1]. I have already reported this behaviour to glibc devs and I'm 
waiting for the response now.

2. "while" loop in the same function skips some results retuned by 
getaddrinfo. Theoretically, this part of code can skip all results 
returned by getaddrinfo, so *sa will be NULL, but after this loop, we 
return APR_SUCCESS without checking for this case.

Attached patch fixes it by returning APR_EGENERAL in this case.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=954007

Regards,
Jan Kaluza

Re: [PATCH] unix/sockaddr.c: return error when call_resolver fails and *sa is 0

Posted by Jan Kaluža <jk...@redhat.com>.
On 05/03/2013 08:41 PM, Stefan Fritsch wrote:
> On Thursday 02 May 2013, Jan Kaluža wrote:
>> Attached patch fixes it by returning APR_EGENERAL in this case.
>
> Thanks. Committed with small tweaks as
>
> http://svn.apache.org/r1478905 trunk
> http://svn.apache.org/r1478909 1.5
> http://svn.apache.org/r1478911 1.4

Thanks

> Cheers,
> Stefan
>

Jan Kaluza


Re: [PATCH] unix/sockaddr.c: return error when call_resolver fails and *sa is 0

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 02 May 2013, Jan Kaluža wrote:
> Attached patch fixes it by returning APR_EGENERAL in this case.

Thanks. Committed with small tweaks as

http://svn.apache.org/r1478905 trunk
http://svn.apache.org/r1478909 1.5
http://svn.apache.org/r1478911 1.4

Cheers,
Stefan