* Bug in getaddrinfo @ 2018-06-21 22:04 Marco Dickert 2018-06-22 2:26 ` Rich Felker 0 siblings, 1 reply; 4+ messages in thread From: Marco Dickert @ 2018-06-21 22:04 UTC (permalink / raw) To: musl [-- Attachment #1: Type: text/plain, Size: 777 bytes --] Hi all. I found a bug in the musl implementation of getaddrinfo(). It apparently returns a bad ai_canonname value. I used this [1] code to produce the following results on an alpine linux (edge): ---- alpine:~# ./addrinfo-test mail.misterunknown.de Result 0 0xda051c83080 Canonname mail.misterunknown.de alpine:~# ./addrinfo-test mail.misterunknown.de. Result 0 0x53f7dac4080 Canonname mail.misterunknown.de. ---- The problem is the trailing dot in the Commonname in the second example, which should not be there. See also this [2] bug report I opened in the first place. Cheers, Marco [1] https://pastebin.com/nypMzhCb [2] https://gitlab.isc.org/isc-projects/bind9/issues/354 -- Marco Dickert marco@misterunknown.de https://misterunknown.de [-- Attachment #2: smime.p7s --] [-- Type: application/x-pkcs7-signature, Size: 5022 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in getaddrinfo 2018-06-21 22:04 Bug in getaddrinfo Marco Dickert @ 2018-06-22 2:26 ` Rich Felker 2018-06-26 9:36 ` Marco Dickert 0 siblings, 1 reply; 4+ messages in thread From: Rich Felker @ 2018-06-22 2:26 UTC (permalink / raw) To: Marco Dickert; +Cc: musl [-- Attachment #1: Type: text/plain, Size: 1429 bytes --] On Fri, Jun 22, 2018 at 12:04:31AM +0200, Marco Dickert wrote: > Hi all. > > I found a bug in the musl implementation of getaddrinfo(). It apparently returns > a bad ai_canonname value. I used this [1] code to produce the following results ^^^ Please attach testcases rather than linking to transient pastebins. I've saved and attached the linked code here. > on an alpine linux (edge): > > ---- > alpine:~# ./addrinfo-test mail.misterunknown.de > Result 0 0xda051c83080 > Canonname mail.misterunknown.de > alpine:~# ./addrinfo-test mail.misterunknown.de. > Result 0 0x53f7dac4080 > Canonname mail.misterunknown.de. > ---- > > The problem is the trailing dot in the Commonname in the second example, which > should not be there. See also this [2] bug report I opened in the first place. Per POSIX, if the canonical name is not available, then ai_canonname shall refer to the nodename argument or a string with the same contents. It's not entirely clear what "available" means, but I think it's generally interpreted as meaning "the requested name is a CNAME". On the other hand we already define availability for another case, search domains, where a duplicate of the requested nodename argument is not returned, so I think it's reasonable to make a change here too, especially if that's what other implementations do. I'll take a look at it. Thanks for the report. Rich [-- Attachment #2: addrinfo-test.c --] [-- Type: text/plain, Size: 592 bytes --] #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <stdio.h> #include <string.h> int main(int argc, char** argv) { struct addrinfo hints, *ai; int result; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; result = getaddrinfo(argv[1], NULL, &hints, &ai); printf("Result %d %p\n", result, ai); if (result == 0 && ai != NULL) { printf("Canonname %s\n", ai->ai_canonname); } } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in getaddrinfo 2018-06-22 2:26 ` Rich Felker @ 2018-06-26 9:36 ` Marco Dickert 2018-06-26 20:40 ` Rich Felker 0 siblings, 1 reply; 4+ messages in thread From: Marco Dickert @ 2018-06-26 9:36 UTC (permalink / raw) To: Rich Felker; +Cc: musl [-- Attachment #1: Type: text/plain, Size: 964 bytes --] Hi, On 2018-06-21 22:26:40, Rich Felker wrote: > On Fri, Jun 22, 2018 at 12:04:31AM +0200, Marco Dickert wrote: > > a bad ai_canonname value. I used this [1] code to produce the following results > ^^^ > Please attach testcases rather than linking to transient pastebins. > I've saved and attached the linked code here. thank you. I should've attached the code indeed; don't know what I thought^^ > On the other hand we already define availability for another case, > search domains, where a duplicate of the requested nodename argument > is not returned, so I think it's reasonable to make a change here too, > especially if that's what other implementations do. I'll take a look > at it. Nice to hear. > Thanks for the report. While were on it: Thanks for the great work with musl libc! I really appreciate it! Cheers, -- Marco Dickert marco@misterunknown.de https://misterunknown.de [-- Attachment #2: smime.p7s --] [-- Type: application/x-pkcs7-signature, Size: 5022 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in getaddrinfo 2018-06-26 9:36 ` Marco Dickert @ 2018-06-26 20:40 ` Rich Felker 0 siblings, 0 replies; 4+ messages in thread From: Rich Felker @ 2018-06-26 20:40 UTC (permalink / raw) To: musl On Tue, Jun 26, 2018 at 11:36:08AM +0200, Marco Dickert wrote: > Hi, > > On 2018-06-21 22:26:40, Rich Felker wrote: > > On Fri, Jun 22, 2018 at 12:04:31AM +0200, Marco Dickert wrote: > > > a bad ai_canonname value. I used this [1] code to produce the following results > > ^^^ > > Please attach testcases rather than linking to transient pastebins. > > I've saved and attached the linked code here. > > thank you. I should've attached the code indeed; don't know what I thought^^ > > > On the other hand we already define availability for another case, > > search domains, where a duplicate of the requested nodename argument > > is not returned, so I think it's reasonable to make a change here too, > > especially if that's what other implementations do. I'll take a look > > at it. > > Nice to hear. > > > Thanks for the report. > > While were on it: Thanks for the great work with musl libc! I really appreciate > it! Should be fixed in git master. Let me know if you see any problems. Rich ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-26 20:40 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-06-21 22:04 Bug in getaddrinfo Marco Dickert 2018-06-22 2:26 ` Rich Felker 2018-06-26 9:36 ` Marco Dickert 2018-06-26 20:40 ` Rich Felker
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/musl/ 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 NNTP newsgroup(s).