summaryrefslogtreecommitdiff
path: root/testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-06-10 00:04:00 +0000
committerroot <root@rshg054.dnsready.net>2012-06-10 00:04:00 +0000
commit7b2739f21a7ed0d52497fa381c9a2383e71ab7a8 (patch)
treee92096f88e034d79e6f814971f98eb098c0abd80 /testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
parent0c7e29df5c6742895884a0bbcf86381f8e601782 (diff)
Sun Jun 10 00:04:00 UTC 2012
Diffstat (limited to 'testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch')
-rw-r--r--testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch b/testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
new file mode 100644
index 000000000..6f0a0398f
--- /dev/null
+++ b/testing/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
@@ -0,0 +1,24 @@
+diff --git a/resolv/res_query.c b/resolv/res_query.c
+index 947c651..abccd4a 100644
+--- a/resolv/res_query.c
++++ b/resolv/res_query.c
+@@ -556,12 +556,16 @@ __libc_res_nquerydomain(res_state statp,
+ * copy without '.' if present.
+ */
+ n = strlen(name);
+- if (n >= MAXDNAME) {
++
++ /* Decrement N prior to checking it against MAXDNAME
++ so that we detect a wrap to SIZE_MAX and return
++ a reasonable error. */
++ n--;
++ if (n >= MAXDNAME - 1) {
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ return (-1);
+ }
+- n--;
+- if (n >= 0 && name[n] == '.') {
++ if (name[n] == '.') {
+ strncpy(nbuf, name, n);
+ nbuf[n] = '\0';
+ } else