From: Florian Weimer <fw@deneb.enyo.de>
To: Anders Kaseorg <andersk@mit.edu>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] hesiod_end: Do not call res_nclose(&_res) [BZ #19573]
Date: Sat, 23 Apr 2016 12:30:00 -0000 [thread overview]
Message-ID: <87eg9wjynn.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <alpine.DEB.2.10.1604221400580.60537@buzzword-bingo.mit.edu> (Anders Kaseorg's message of "Fri, 22 Apr 2016 14:25:41 -0400 (EDT)")
* Anders Kaseorg:
> 2016-04-22 Anders Kaseorg <andersk@mit.edu>
>
> [BZ #19573]
> * hesiod/hesiod.c (hesiod_end): Only call res_nclose(ctx->res) if
> ctx->free_res is nonnull, to prevent a crash on res_nclose(&res)
> introduced by commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7
> (Simplify handling of nameserver configuration in resolver).
>
> diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
> index 657dabe..a540382 100644
> --- a/hesiod/hesiod.c
> +++ b/hesiod/hesiod.c
> @@ -152,12 +152,12 @@ hesiod_end(void *context) {
> struct hesiod_p *ctx = (struct hesiod_p *) context;
> int save_errno = errno;
>
> - if (ctx->res)
> + if (ctx->res && ctx->free_res) {
> res_nclose(ctx->res);
> + (*ctx->free_res)(ctx->res);
> + }
Please use GNU style (braces on separate lines, two-space
indentation).
> free(ctx->RHS);
> free(ctx->LHS);
> - if (ctx->res && ctx->free_res)
> - (*ctx->free_res)(ctx->res);
This is one way to fix this bug. Its correctness depends on whether
we export in any way the hesiod functionality. I thought we did, but
libhesiod is actually a separate thing, and checking with eu-readelf,
I don't see any exports of the helper functions.
If there are no external users of the callback mechanism, we do not
have to worry about the behavioral change.
I would welcome a quick double-check on this aspect.
next prev parent reply other threads:[~2016-04-23 12:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 18:25 Anders Kaseorg
2016-04-23 12:30 ` Florian Weimer [this message]
2016-04-23 18:37 ` Anders Kaseorg
2016-04-27 15:36 ` Anders Kaseorg
2016-04-27 18:19 ` Florian Weimer
2016-04-30 23:17 ` Anders Kaseorg
2016-05-02 10:02 ` Florian Weimer
2016-05-02 10:16 ` Anders Kaseorg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eg9wjynn.fsf@mid.deneb.enyo.de \
--to=fw@deneb.enyo.de \
--cc=andersk@mit.edu \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).