mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-05 08:59:05 +00:00
fix: resolve bugs introduced during high severity vulnerability remediation
This commit is contained in:
@@ -580,14 +580,14 @@ async fn download_attempt(
|
||||
)));
|
||||
}
|
||||
|
||||
let mut resumed = existing_len > 0 && response.status() == StatusCode::PARTIAL_CONTENT;
|
||||
let resumed = existing_len > 0 && response.status() == StatusCode::PARTIAL_CONTENT;
|
||||
if resumed {
|
||||
let content_range = response
|
||||
.headers()
|
||||
.get(reqwest::header::CONTENT_RANGE)
|
||||
.and_then(|h| h.to_str().ok());
|
||||
if !content_range.is_some_and(|r| r.starts_with(&format!("bytes {}-", existing_len))) {
|
||||
resumed = false;
|
||||
return Err(AttemptError::Failed("Server returned invalid Content-Range for resume".to_string()));
|
||||
}
|
||||
}
|
||||
let completed_at_start = if resumed { existing_len } else { 0 };
|
||||
|
||||
@@ -337,7 +337,7 @@ fn claim_request(signature: &str, timestamp: u64, replay_cache: &ReplayCache) ->
|
||||
};
|
||||
cache.retain(|_, seen_at| now.saturating_sub(*seen_at) < SIGNATURE_MAX_AGE_MS);
|
||||
if cache.len() > 10_000 {
|
||||
cache.clear();
|
||||
return false;
|
||||
}
|
||||
let key = format!("{timestamp}:{}", signature.to_ascii_lowercase());
|
||||
cache.insert(key, now).is_none()
|
||||
|
||||
Reference in New Issue
Block a user