Subject: Re: Possible bug in (cvs) ares_parse_srv_reply.c /

Re: Possible bug in (cvs) ares_parse_srv_reply.c /

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 26 Oct 2009 17:13:26 +0100 (CET)

On Mon, 26 Oct 2009, Jakub Hrozek wrote:

> I'm aware that with srv_out == NULL you get a crash -- I'm still not sure
> which way of coding is preferred within c-ares, be it the more defensive one
> of ares_parse_{a,aaaa}_reply or the one of ptr/srv. If a very defensive way
> of checking is preferred, I think the parsing function should just return
> something like ARES_EINVAL or similar..

Personally I tend to prefer a "strict usage" where the arguments are not
optional (ie they must not be NULL) and the function implementations can
assume that they are set correctly as per the documentation. assert()s etc
could be used to verify for debug-builds.

But I'm open for what others think. If we have documented these functions to
allow NULL for not storing any info, then we should of course check them. We
should be consistent among all the functions that are so similar methinks.

-- 
  / daniel.haxx.se
Received on 2009-10-26