Message ID | 1401838603-22101-4-git-send-email-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
There is another use of statp->nscount in send_dg. That should be changed as well, otherwise it can result in a div by 0. Andreas.
On Wed, Jun 04, 2014 at 12:44:13PM +0200, Andreas Schwab wrote: > There is another use of statp->nscount in send_dg. That should be > changed as well, otherwise it can result in a div by 0. Good catch, I fixed that locally, it will be in the next version of the patches.
diff --git a/resolv/res_init.c b/resolv/res_init.c index 37004ab..95564af 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -427,7 +427,7 @@ __res_vinit(res_state statp, int preinit) { #endif (void) fclose(fp); } - if (__builtin_expect(statp->nscount == 0, 0)) { + if (__builtin_expect(nservall == 0, 0)) { statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); statp->nsaddr.sin_family = AF_INET; statp->nsaddr.sin_port = htons(NAMESERVER_PORT); diff --git a/resolv/res_send.c b/resolv/res_send.c index af42b8a..08fc037 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -347,7 +347,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen, { int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; - if (statp->nscount == 0) { + if ((statp->nscount + EXT(statp).nscount6) == 0) { __set_errno (ESRCH); return (-1); }