Fix a DoS in Monero

A malicious TX could cause an arbitrary amount of memory to be allocated 
despite not even containing that amount of data.
This commit is contained in:
Luke Parker 2022-08-21 07:52:49 -04:00
parent 8af3a9ea51
commit d12507e612
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6

View file

@ -100,7 +100,7 @@ pub fn read_raw_vec<R: io::Read, T, F: Fn(&mut R) -> io::Result<T>>(
len: usize,
r: &mut R,
) -> io::Result<Vec<T>> {
let mut res = Vec::with_capacity(len);
let mut res = vec![];
for _ in 0 .. len {
res.push(f(r)?);
}