Fix buffer overrun in rtn_extended_encoding

`idx + i` can range from `0` to `buf.len`, but the memcpy may try and write to offsets from `idx + i` to `idx + 2 * i`.
This commit is contained in:
mchesser 2022-03-07 14:39:36 +10:30
parent c2229b506e
commit 2a00f32666

View File

@ -2323,7 +2323,7 @@ static u8 rtn_extend_encoding(afl_state_t *afl, u8 entry,
if (unlikely(its_fuzz(afl, buf, len, status))) { return 1; }
// fprintf(stderr, "RTN ATTEMPT fromhex %u result %u\n", fromhex,
// *status);
memcpy(buf + idx + i, save + i, i + 1 + off);
memcpy(buf + idx, save, i + 1 + off);
}