Open suchipi opened 10 years ago
Using gcc 4.4.7 on CentOS 6.5 x86_64 Linux srv 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@srv pwnat-master]# make
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o socket.o socket.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o message.o message.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o strlcpy.o strlcpy.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o client.o client.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o packet.o packet.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o list.o list.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o destination.o destination.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o udpserver.o udpserver.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -c -o udpclient.o udpclient.c
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX -o pwnat pwnat.c socket.o message.o strlcpy.o client.o packet.o list.o destination.o udpserver.o udpclient.o
[root@srv pwnat-master]# ./pwnat -s
Segmentation fault (core dumped)
[root@srv pwnat-master]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
I am also experiencing a segfault at udpserver.c:186, stemming from gethostbyname (which the man page reports as obsolete) returning a null pointer on line 179.
I am running Gentoo linux with version 2.20 of libc
gethostbyname is returning null and not setting errno. This turns out to be a sign that the DNS lookup is failing.
I fixed it by editing my /etc/hosts, adding hostname to the line: '127.0.0.1 hostname localhost'
this is likely specific to gentoo, and this stack overflow suggests that gethostbyname is requiring a DNS configuration that is not needed in configurations like mine, using dhcp with no DNS server. http://stackoverflow.com/questions/8106882/cant-obtain-local-ip-using-gethostbyname
I'm accepting patches if anyone wants to take a stab! Not reproducing in my environment, haven't had a chance to take a look further.
Has anyone taken a crack at this yet since 2015? I'm about to try to run a pwnat server on FBSD 12.
Using gcc 4.7.3 on FreeBSD 10.0-RELEASE x86-64:
Compiles and runs successfully on Debian 7 x86-64 using gcc 4.7.2.