jvinet / knock

A port-knocking daemon
http://www.zeroflux.org/projects/knock
GNU General Public License v2.0
552 stars 114 forks source link

getnameinfo does nothing #34

Closed thedolphin closed 8 years ago

thedolphin commented 8 years ago

...and myip->value stays NULL, then knockd gets SIGFAULT in generate_pcap_filter()

I can't figure out why

CentOS 7.2 knockd from master branch as of today.

thedolphin commented 8 years ago
Breakpoint 1, __GI_getnameinfo (sa=0x61d4e0, addrlen=16, host=0x0, hostlen=1025, serv=0x0, servlen=0, flags=1) at getnameinfo.c:163
163 {
(gdb) s
164   int serrno = errno;
(gdb) s
171   if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM
(gdb) s
167   char *tmpbuf = alloca (tmpbuflen);
(gdb)
163 {
(gdb) s
167   char *tmpbuf = alloca (tmpbuflen);
(gdb) s
163 {
(gdb) s
164   int serrno = errno;
(gdb) s
167   char *tmpbuf = alloca (tmpbuflen);
(gdb) s
171   if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM
(gdb) s
164   int serrno = errno;
(gdb) s
171   if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM
(gdb) s
178   if (sa == NULL || addrlen < sizeof (sa_family_t))
(gdb) s
181   if ((flags & NI_NAMEREQD) && host == NULL && serv == NULL)
(gdb) s
184   switch (sa->sa_family)
(gdb) s
191       if (addrlen < sizeof (struct sockaddr_in))
(gdb) s
202   if (host != NULL && hostlen > 0)
(gdb) s
165   int tmpbuflen = 1024;
(gdb) s
392   if (serv && (servlen > 0))
(gdb) s
430   if (host && (hostlen > 0))
(gdb) s
432   if (serv && (servlen > 0))
(gdb) s
434   errno = serrno;
(gdb) s
435   return 0;
(gdb) q
thedolphin commented 8 years ago

Oh, my brains.

myip->value expected to be preallocated, while it's NULL

airwoflgh commented 8 years ago

Included in the 0.7.7-fixes branch.

airwoflgh commented 8 years ago

Pull request back to master raised.