[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] check for errors from evdns_base_resolv_conf_parse() is not correct



On Wed, Sep 04, 2019 at 04:14:33PM +0300, Maxim Gorbachyov wrote:
> Hello.
> 
> It seems libevent check for errors from evdns_base_resolv_conf_parse()
> is not correct:
> 
> evdns_base_resolv_conf_parse() returns positive error codes as described here:
> http://www.wangafu.net/~nickm/libevent-2.1/doxygen/html/dns_8h.html#a7e3a053e25ae7c045944a5db0947babb
> 
> Implementation:
> https://github.com/libevent/libevent/blob/194a5d822651c03fc988c1bf087e65ed20f453f7/evdns.c#L3660
> 
> But callers check for "-1":
> https://github.com/libevent/libevent/blob/194a5d822651c03fc988c1bf087e65ed20f453f7/evdns.c#L4035
> or for negative int:
> https://github.com/libevent/libevent/blob/194a5d822651c03fc988c1bf087e65ed20f453f7/sample/dns-example.c#L228

Hi!

Nice catch, thanks for the report and details!

Fixed in [1]:

    c3f35345 ("Fix checking return value of the evdns_base_resolv_conf_parse()")

    [1]: https://github.com/libevent/libevent/commit/c3f353450e94248ee677a068ed2c4ed29d64f79e

-- 
Azat.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.