From ad1aec3d89a2f9b57030cb3047674df17b9ec63c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 26 Oct 2022 12:49:34 +0200 Subject: [PATCH] Reject odd number of hexits rather than ignoring the lone trailing hexit --- implementations/rust/preserves/src/hex.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/implementations/rust/preserves/src/hex.rs b/implementations/rust/preserves/src/hex.rs index 7adb7cf..14fd09b 100644 --- a/implementations/rust/preserves/src/hex.rs +++ b/implementations/rust/preserves/src/hex.rs @@ -36,7 +36,11 @@ impl HexParser { }, } } - Some(result) + if buf_full { + None // odd number of hexits + } else { + Some(result) + } } }