standards/114910: getaddrinfo() fails to set ai_canonname
JINMEI Tatuya / 神明達哉
jinmei at isl.rdc.toshiba.co.jp
Fri Aug 3 10:00:12 UTC 2007
The following reply was made to PR standards/114910; it has been noted by GNATS.
From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?=
<jinmei at isl.rdc.toshiba.co.jp>
To: marka at isc.org
Cc: bug-followup at FreeBSD.org
Subject: Re: standards/114910: getaddrinfo() fails to set ai_canonname
Date: Fri, 03 Aug 2007 18:57:27 +0900
Thanks for the report. Yes, it's a bug to be fixed.
I think it should be handled around reorder() rather than in
getanswer() since the same problem would happen for other resolution
methods.
I've copied an alternate proposed patch below.
JINMEI, Tatuya
Communication Platform Lab.
Corporate R&D Center, Toshiba Corp.
jinmei at isl.rdc.toshiba.co.jp
Index: getaddrinfo.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.85
diff -u -r1.85 getaddrinfo.c
--- getaddrinfo.c 23 Jul 2006 15:31:03 -0000 1.85
+++ getaddrinfo.c 3 Aug 2007 09:52:57 -0000
@@ -578,8 +578,24 @@
* in the most efficient order.
*/
if (hints == NULL || !(hints->ai_flags & AI_PASSIVE)) {
- if (!numeric)
+ if (!numeric) {
+ char *canonname;
+
+ canonname =
+ sentinel.ai_next->ai_canonname;
+ if (canonname != NULL) {
+ sentinel.ai_next->ai_canonname
+ = NULL;
+ }
(void)reorder(&sentinel);
+ if (sentinel.ai_next->ai_canonname ==
+ NULL) {
+ sentinel.ai_next->ai_canonname
+ = canonname;
+ } else {
+ free(canonname);
+ }
+ }
}
*res = sentinel.ai_next;
return SUCCESS;
More information about the freebsd-standards
mailing list