mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
in dns parsing callback, enforce MAXADDRS to preclude overflow
MAXADDRS was chosen not to need enforcement, but the logic used to compute it assumes the answers received match the RR types of the queries. specifically, it assumes that only one replu contains A record answers. if the replies to both the A and the AAAA query have their answer sections filled with A records, MAXADDRS can be exceeded and clobber the stack of the calling function. this bug was found and reported by Felix Wilhelm.
This commit is contained in:
parent
5b5eb527c5
commit
45ca5d3fcb
1 changed files with 1 additions and 0 deletions
|
@ -111,6 +111,7 @@ static int dns_parse_callback(void *c, int rr, const void *data, int len, const
|
|||
{
|
||||
char tmp[256];
|
||||
struct dpc_ctx *ctx = c;
|
||||
if (ctx->cnt >= MAXADDRS) return -1;
|
||||
switch (rr) {
|
||||
case RR_A:
|
||||
if (len != 4) return -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue