Skip to content

Commit

Permalink
x509-cert: use ErrorKind::Value for overlength serial (#988)
Browse files Browse the repository at this point in the history
This at least surfaces that the error has to do with an integer field,
which would've been helpful with tracing it down to SerialNumber.

`Overlength` has a bit of a specific meaning in the context of the
`ErrorKind`, namely it's used for framing errors, which isn't what's
occurring here.

Perhaps the `der` documentation should help clarify this.
  • Loading branch information
tarcieri authored Apr 5, 2023
1 parent 91e9607 commit 7827172
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x509-cert/src/serial_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'a> DecodeValue<'a> for SerialNumber {
// since some X.509 implementations interpret the limit of 20 bytes to refer
// to the pre-encoded value.
if inner.len() > SerialNumber::MAX_DECODE_LEN {
return Err(ErrorKind::Overlength.into());
return Err(Tag::Integer.value_error());
}

Ok(Self { inner })
Expand Down

0 comments on commit 7827172

Please sign in to comment.