This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308)


Siddhesh Poyarekar <siddhesh@redhat.com> writes:

> diff --git a/resolv/res_query.c b/resolv/res_query.c
> index a9db837..4e6612c 100644
> --- a/resolv/res_query.c
> +++ b/resolv/res_query.c
> @@ -382,7 +382,9 @@ __libc_res_nsearch(res_state statp,
>  					      answer, anslen, answerp,
>  					      answerp2, nanswerp2, resplen2,
>  					      answerp2_malloced);
> -		if (ret > 0 || trailing_dot)
> +		if (ret > 0 || trailing_dot
> +		    /* If the second response is valid then we use that.  */
> +		    || (ret == 0 && answerp2 != NULL && resplen2 > 0))

That doesn't make sense, resplen2 is a pointer.  I'm surprised that the
compiler does not warn about that.

I think that answerp2 != NULL should be resplen2 != NULL.

> @@ -422,7 +424,8 @@ __libc_res_nsearch(res_state statp,
>  						      answer, anslen, answerp,
>  						      answerp2, nanswerp2,
>  						      resplen2, answerp2_malloced);
> -			if (ret > 0)
> +			if (ret > 0 || (ret == 0 && answerp2 != NULL
> +					&& resplen2 > 0))

Likewise.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]