<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi all,<br>
<br>
I've been working on an effort to override some (libc) <i>getaddrinfo()</i>
calls into <i>ares_getaddrinfo()</i> calls (see recent mail
regarding LD_PRELOAD). I notice that in some cases, <i>getaddrinfo()</i>
is getting passed a null <i>node</i> pointer. In the docs for the
function, it states that:<br>
</p>
<pre>"Either <i>node</i> or <i>service</i>, but not both, may be NULL."
</pre>
<p>and that:<br>
</p>
<pre>"If <i>node</i> is NULL, then the network address will be set to the loopback interface address ..."</pre>
<p><br>
Now in the <i>ares_getaddrinfo() </i>docs, the equivalent
behavior of passing in a null <i>name</i> pointer is undefined.
And I'm seeing the following segfault splat when a null <i>name</i>
pointer is used:<br>
<br>
</p>
<pre>#0 __strchr_avx2 () at ../sysdeps/x86_64/multiarch/strchr-avx2.S:65
#1 0x00007f3e02488848 in ares__single_domain (channel=0x1daa7f0, name=0x0, s=0x7ffc98f50608) at ares_search.c:288
#2 0x00007f3e0247ec49 in ares_getaddrinfo_int (channel=0x1daa7f0, name=0x0, service=0x7ffc98f50912 "5201",
hints=0x7ffc98f507e0, callback=0x7f3e0266a376 <ai_callback>, arg=0x7ffc98f50918) at ares_getaddrinfo.c:568
#3 0x00007f3e0247f14e in ares_getaddrinfo (channel=0x1daa7f0, name=0x0, service=0x7ffc98f50912 "5201",
hints=0x7ffc98f507e0, callback=0x7f3e0266a376 <ai_callback>, arg=0x7ffc98f50918) at ares_getaddrinfo.c:681
#4 0x00007f3e0266a9fb in getaddrinfo (libc_node=0x0, libc_service=0x7ffc98f50912 "5201", libc_hints=0x7ffc98f50920,
libc_res=0x7ffc98f50918) at intercept.c:158
</pre>
So I was curious, what is the expected behavior when a null <i>name</i>
pointer is passed into <i>ares_getaddrinfo()</i>?<br>
<br>
Thanks,<br>
<br>
Carson
<p></p>
</body>
</html>