Prevent an eventual out of range index
This commit is contained in:
parent
d9eecf1f5f
commit
d4f92bc430
1 changed files with 2 additions and 2 deletions
|
@ -33,8 +33,8 @@ fn header_end_pos(data: &[u8]) -> Result<usize, ()> {
|
|||
.windows(2)
|
||||
.position(|w| w == b"\r\n")
|
||||
.ok_or(())? + 2;
|
||||
if ret == max_len {
|
||||
return Ok(ret);
|
||||
if ret >= max_len {
|
||||
return Ok(max_len);
|
||||
}
|
||||
if !is_wsp(data[ret]) {
|
||||
return Ok(ret);
|
||||
|
|
Loading…
Reference in a new issue