Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/domain_fronter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,12 @@ impl DomainFronter {
let end = text.rfind('}').ok_or_else(|| {
FronterError::BadResponse("no json end in tunnel response".into())
})?;
if start > end {
return Err(FronterError::BadResponse(format!(
"no valid json object in: {}",
&text.chars().take(200).collect::<String>()
)));
}
&text[start..=end]
};
Ok(serde_json::from_str(json_str)?)
Expand Down Expand Up @@ -3205,6 +3211,12 @@ impl DomainFronter {
let end = text.rfind('}').ok_or_else(|| {
FronterError::BadResponse("no json end in batch response".into())
})?;
if start > end {
return Err(FronterError::BadResponse(format!(
"no valid json object in: {}",
&text.chars().take(200).collect::<String>()
)));
}
&text[start..=end]
};
// Don't log payload content. Batch responses carry base64-encoded
Expand Down Expand Up @@ -4574,6 +4586,12 @@ fn parse_relay_json(body: &[u8]) -> Result<Vec<u8>, FronterError> {
&text[..text.len().min(200)]
))
})?;
if start > end {
return Err(FronterError::BadResponse(format!(
"no valid json object in: {}",
&text.chars().take(200).collect::<String>()
)));
}
serde_json::from_str(&text[start..=end])?
}
}
Expand Down
Loading