mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2026-02-13 10:21:30 +00:00
configure: add -Werror for implicit func decls (fix netbsd segfault)
without -Werror=implicit-function-declaration our test for GNU-style
getservbyname_r silently succeeds on NetBSD 10
(because the function exists, so the testcase links successfully).
however NetBSD's version has a completely different signature which
leads to crashes at runtime:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000f1707faa2b78 in free () from /usr/lib/libc.so.12
[Current thread is 1 (process 25072)]
(gdb) backtrace
#0 0x0000f1707faa2b78 in free () from /usr/lib/libc.so.12
#1 0x0000f1707fac58b0 in _servent_open () from /usr/lib/libc.so.12
#2 0x0000f1707fac5a60 in setservent_r () from /usr/lib/libc.so.12
#3 0x0000f1707fac4490 in getservbyname_r () from /usr/lib/libc.so.12
#4 0x0000f17080235788 in mygetservbyname_r (name=0xf1707f847ab0 "80", proto=0x0, result_buf=0xffffffe29738, buf=0xffffffe29338 "", buflen=1024, result=0xffffffe29758) at src/core.c:917
#5 0x0000f17080235aa8 in proxy_getaddrinfo (node=0xf1707f847ba0 "4get.nadeko.net", service=0xf1707f847ab0 "80", hints=0xffffffe29978, res=0xffffffe29968) at src/core.c:1004
#6 0x0000f17080238a94 in getaddrinfo (node=0xf1707f847ba0 "4get.nadeko.net", service=0xf1707f847ab0 "80", hints=0xffffffe29978, res=0xffffffe29968) at src/libproxychains.c:795
netbsd's signature is:
struct servent *
getservbyname_r(const char *name, const char *proto, struct servent *sp,
struct servent_data *sd)
and basically the first thing it does is to free existing members of the
sd struct, which obviously crashes when the thing passed as 4th argument
isn't actually that kind of struct.
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -182,6 +182,7 @@ ishaiku() {
|
||||
check_compile 'whether C compiler works' '' 'int main() {return 0;}' || fail 'error: install a C compiler and library'
|
||||
check_compile 'whether libc headers are complete' '' '#include <netdb.h>\nint main() {return 0;}' || fail 'error: necessary libc headers are not installed'
|
||||
check_compile 'whether C compiler understands -Wno-unknown-pragmas' '-Wno-unknown-pragmas' 'int main() {return 0;}'
|
||||
check_compile 'whether C compiler understands -Werror=implicit-function-declaration' '-Werror=implicit-function-declaration' 'int main() {return 0;}'
|
||||
|
||||
if ! check_compile 'whether getnameinfo() servlen argument is POSIX compliant (socklen_t)' "-DGN_NODELEN_T=socklen_t -DGN_SERVLEN_T=socklen_t -DGN_FLAGS_T=int" \
|
||||
'#define _GNU_SOURCE\n#include <netdb.h>\nint getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);int main() {\nreturn 0;}' ; then
|
||||
|
||||
Reference in New Issue
Block a user