From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8544 Path: news.gmane.org!not-for-mail From: Julien Ramseier Newsgroups: gmane.linux.lib.musl.general Subject: getaddrinfo and null args Date: Tue, 22 Sep 2015 13:40:13 +0200 Message-ID: <2190F767-A1C5-4ED9-8575-FF55565B8317@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_2269AAAC-5C26-4DE3-A005-5FB21C35EB17" X-Trace: ger.gmane.org 1442922047 19407 80.91.229.3 (22 Sep 2015 11:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2015 11:40:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8556-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 22 13:40:46 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZeLwC-0000Jx-9m for gllmg-musl@m.gmane.org; Tue, 22 Sep 2015 13:40:44 +0200 Original-Received: (qmail 11509 invoked by uid 550); 22 Sep 2015 11:40:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11398 invoked from network); 22 Sep 2015 11:40:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=LEUZq8Qq3gBzJgBIgPepxH+9xxk/DVNeIkwcvtnBAuc=; b=WtLNlS5v9Plb/zLzWfNAfzU+vJVoud3p/au5a2yW7MH/BaX5i5HGyqh36eMRbvc+Wg 5KkgeZ1ZcVjI9ajliN5RYHtGC3Tpw6APLsOS3gOZLwUPIs3biGmiPAjreW29sBNjzBLK pla6DNOgdYDj3xw3gMZVUMUT856cFCvaPj8U7zC7NdmdnWTdQ7ViqpMozp8FcTDrPFKn o5H9q7jQOWXmleegh1l7mZeFEGXHl6Q/P3piZMaD/UzPzidMw5pN1Nx7BzdEzC0XIBwK UeMTZA029/z0IREKW28dYBFaVk4kLwF6fUbozvwwr0h5Yz9TsqeNIluyriU3ef47szHH wEHg== X-Received: by 10.180.198.109 with SMTP id jb13mr19698325wic.17.1442922015549; Tue, 22 Sep 2015 04:40:15 -0700 (PDT) X-Mailer: Apple Mail (2.2102) Xref: news.gmane.org gmane.linux.lib.musl.general:8544 Archived-At: --Apple-Mail=_2269AAAC-5C26-4DE3-A005-5FB21C35EB17 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hello, According to = http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.htm= l: "The nodename and servname arguments are either null pointers or = pointers to null-terminated strings. One or both of these two arguments shall be = supplied=20 by the application as a non-null pointer. " "[EAI_NONAME] Neither nodename nor servname were supplied. At least one of these shall = be supplied." getaddrinfo() currently accepts both nodename and servname being null. Following patch fixes the problem: --Apple-Mail=_2269AAAC-5C26-4DE3-A005-5FB21C35EB17 Content-Disposition: attachment; filename=fix-getaddrinfo-both-null-args.diff Content-Type: application/octet-stream; name="fix-getaddrinfo-both-null-args.diff" Content-Transfer-Encoding: 7bit diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index c88d558..d69ec98 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -20,6 +20,9 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru } sa; } *out; + if (host == NULL && serv == NULL) + return EAI_NONAME; + if (hint) { family = hint->ai_family; flags = hint->ai_flags; --Apple-Mail=_2269AAAC-5C26-4DE3-A005-5FB21C35EB17 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 =E2=80=94 Julien= --Apple-Mail=_2269AAAC-5C26-4DE3-A005-5FB21C35EB17--