summaryrefslogtreecommitdiff
path: root/staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-06-11 15:22:39 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-06-11 15:22:39 -0300
commitd9929db3b4ad2dfeeb19ad71f6016eb8122d0208 (patch)
tree72944f18f0c554390a9ced86c8a8e2c06ce6cc47 /staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
parent54452120abed3fa83e394e89110859525788c0ea (diff)
parent306ac55c1e99cfb5801ef0d9acf2a11d3994d80d (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community/hostapd/PKGBUILD extra/samba/PKGBUILD staging/ffmpeg/PKGBUILD
Diffstat (limited to 'staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch')
-rw-r--r--staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch b/staging/glibc/glibc-2.15-__libc_res_nquerydomain-out-of-bounds.patch
new file mode 100644
index 000000000..6f0a0398f
--- /dev/null
+++ b/staging/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