From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix getaddrinfo
Date: Wed, 23 Apr 2003 09:58:00 -0000 [thread overview]
Message-ID: <20030423095652.GX16629@sunsite.ms.mff.cuni.cz> (raw)
Hi!
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=91234&action=view
has a testcase. If the caller manages to leave -1 on the stack in the place
which becomes herrno, then gaih_inet will eat all the stack and die.
Fixed thusly:
2003-04-23 Jakub Jelinek <jakub@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Check for rc == ERANGE,
not rc == errno. Use extend_alloca.
--- libc/sysdeps/posix/getaddrinfo.c.jj 2002-12-20 07:36:31.000000000 -0500
+++ libc/sysdeps/posix/getaddrinfo.c 2003-04-23 05:15:51.000000000 -0400
@@ -677,13 +677,11 @@ gaih_inet (const char *name, const struc
int herrno;
struct hostent th;
size_t tmpbuflen = 512;
- char *tmpbuf;
+ char *tmpbuf = NULL;
do
{
- tmpbuflen *= 2;
- tmpbuf = __alloca (tmpbuflen);
-
+ tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
rc = __gethostbyaddr_r (at2->addr,
((at2->family == AF_INET6)
? sizeof(struct in6_addr)
@@ -692,7 +690,7 @@ gaih_inet (const char *name, const struc
&h, &herrno);
}
- while (rc == errno && herrno == NETDB_INTERNAL);
+ while (rc == ERANGE && herrno == NETDB_INTERNAL);
if (rc != 0 && herrno == NETDB_INTERNAL)
{
Jakub
next reply other threads:[~2003-04-23 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-23 9:58 Jakub Jelinek [this message]
2003-04-23 17:22 ` Ulrich Drepper
-- strict thread matches above, loose matches on Subject: below --
2001-02-01 7:44 Jakub Jelinek
2001-02-02 0:13 ` Ulrich Drepper
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=20030423095652.GX16629@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=roland@redhat.com \
/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).