diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-07-16 09:53:45 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-07-16 09:53:45 +0000 |
commit | c83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (patch) | |
tree | d47fb1fa79c201c98e2fa7bb8dfeb6ed582beef0 /resolv | |
parent | 1cb6b555a864f401c8a2ba75814e982b66a62971 (diff) |
Updated to fedora-glibc-20080716T0944cvs/fedora-glibc-2_8_90-9
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/res_query.c | 26 | ||||
-rw-r--r-- | resolv/res_send.c | 1 |
2 files changed, 22 insertions, 5 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c index 3d2f2fe3a9..b2b45acde7 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -146,18 +146,34 @@ __libc_res_nquery(res_state statp, { if ((oflags & RES_F_EDNS0ERR) == 0 && (statp->options & RES_USE_EDNS0) != 0) - n = __res_nopt(statp, n, query1, bufsize, anslen / 2); + { + n = __res_nopt(statp, n, query1, bufsize, anslen / 2); + if (n < 0) + goto unspec_nomem; + } nquery1 = n; - query2 = buf + nquery1; + /* Align the buffer. */ + int npad = ((nquery1 + __alignof__ (HEADER) - 1) + & ~(__alignof__ (HEADER) - 1)) - nquery1; + if (n > bufsize - npad) + { + n = -1; + goto unspec_nomem; + } + int nused = n + npad; + query2 = buf + nused; n = res_nmkquery(statp, QUERY, name, class, T_AAAA, NULL, 0, - NULL, query2, bufsize - n); + NULL, query2, bufsize - nused); if (n > 0 && (oflags & RES_F_EDNS0ERR) == 0 && (statp->options & RES_USE_EDNS0) != 0) - n = __res_nopt(statp, n, query2, bufsize - n, anslen / 2); + n = __res_nopt(statp, n, query2, bufsize - nused - n, + anslen / 2); nquery2 = n; } + + unspec_nomem:; } else { @@ -188,8 +204,10 @@ __libc_res_nquery(res_state statp, if ((statp->options & RES_USE_EDNS0) != 0 && ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) { statp->_flags |= RES_F_EDNS0ERR; +#ifdef DEBUG if (statp->options & RES_DEBUG) printf(";; res_nquery: retry without EDNS0\n"); +#endif goto again; } #ifdef DEBUG diff --git a/resolv/res_send.c b/resolv/res_send.c index e78ff967aa..dec3ac7a3f 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -194,7 +194,6 @@ static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *); /* Reachover. */ static void convaddr4to6(struct sockaddr_in6 *sa); -void res_pquery(const res_state, const u_char *, int, FILE *); /* Public. */ |