Fix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: I5e167b6717d7f90ba782e26ef553fb6d302b493a
This commit is contained in:
Ken Chen 2020-08-30 05:25:44 +00:00 committed by Automerger Merge Worker
commit cf6b3ecd4d

View file

@ -948,6 +948,8 @@ send_vc(res_state statp, struct __res_params* params,
else
break;
}
// return size should never exceed container size
resplen = anssiz;
}
/*
* If the calling applicating has bailed out of
@ -960,7 +962,7 @@ send_vc(res_state statp, struct __res_params* params,
DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer (unexpected):\n"),
ans, (resplen > anssiz) ? anssiz: resplen);
ans, resplen);
goto read_len;
}