Module: ngircd.git Branch: master Commit: ed72bf4cebe47dda78a41fbeebe803caa13f2cfa URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=ed72b...
Author: Florian Westphal fw@strlen.de Date: Fri Sep 11 23:09:11 2009 +0200
resolve.c: fix valgrind 'uninitialized memory' warning
fix the following warning generated by valgrind if ipv6 is enabled:
Syscall param write(buf) points to uninitialised byte(s) at 0x4000982: (within /lib/ld-2.9.so) by 0x80681A8: Resolve_Name (resolve.c:477) by 0x805439F: Conn_Handler (conn.c:1658) by 0x804AA7C: main (ngircd.c:331)
The warning is because ng_ipaddr_t can be a union, and only the necessary parts are initialised. The callers know what part of the union is valid, so this is not a bug.
---
src/ngircd/resolve.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/ngircd/resolve.c b/src/ngircd/resolve.c index 20077a4..b1487be 100644 --- a/src/ngircd/resolve.c +++ b/src/ngircd/resolve.c @@ -291,6 +291,8 @@ ForwardLookup(const char *hostname, array *IpAddr) if (!Conf_ConnectIPv4) hints.ai_family = AF_INET6; #endif + memset(&addr, 0, sizeof(addr)); + res = getaddrinfo(hostname, NULL, &hints, &ai_results); switch (res) { case 0: break;
ngircd-commits@lists.barton.de