diff options
| author | tv <tv@krebsco.de> | 2026-11-15 16:31:47 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-15 16:31:47 +0000 |
| commit | b0d68ad3b99aa06029f30d7dc45455108b52dadc (patch) | |
| tree | 258ded69f1db30e6effcb3091ef334d843a9d5f2 /src | |
| parent | 3152af43504bcfd6285d41f6b6ff67631d01fd0e (diff) | |
api: a signed write after the last seq there is a conflict, not a panic
`put_signed` added one to the `seq` of the envelope there unchecked:
at `u64::MAX` it panicked where overflow is checked and wrapped where
it isn't. It adds as `envelope::check` does, and nothing follows
`u64::MAX`: `409`, as for any write not numbered after what is there.
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/store.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/api/store.rs b/src/api/store.rs index f0b3094..3ecba58 100644 --- a/src/api/store.rs +++ b/src/api/store.rs @@ -569,7 +569,7 @@ async fn put_signed( let signed = envelope::read(&sealed).map_err(bad)?; let next = previous .as_deref() - .map_or(Some(0), |before| Some(envelope::seq(before)? + 1)); + .map_or(Some(0), |before| envelope::seq(before)?.checked_add(1)); if signed.prev != envelope::digest(previous.as_deref()) || Some(signed.seq) != next { return Err(ApiError( StatusCode::CONFLICT, |
