mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 02:24:12 +02:00
harden against dos with crafted input by limiting reserved vec/map size
This commit is contained in:
parent
42c0eb2c89
commit
3caadadb3b
7 changed files with 14 additions and 7 deletions
|
|
@ -7,6 +7,7 @@ use crate::demo::packet::stringtable::{
|
|||
};
|
||||
use crate::demo::parser::ParseBitSkip;
|
||||
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||
use std::cmp::min;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CreateStringTableMessage {
|
||||
|
|
@ -149,7 +150,7 @@ struct TableEntries {
|
|||
impl TableEntries {
|
||||
pub fn new(count: usize) -> Self {
|
||||
TableEntries {
|
||||
entries: Vec::with_capacity(count),
|
||||
entries: Vec::with_capacity(min(count, 128)),
|
||||
history: Vec::with_capacity(32),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue