From 47e4bff0ee8e17bddbc96ad4e907439f5ea9feaa Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 5 Jun 2024 08:39:47 +1000 Subject: [PATCH] pow: Fix off-by-one error Length check has an off-by-one error in it, we want the check it include hex strings of length 32 (eg, 128 bytes). --- bitcoin/src/pow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs index 1642bef46..01e895a15 100644 --- a/bitcoin/src/pow.rs +++ b/bitcoin/src/pow.rs @@ -497,7 +497,7 @@ impl U256 { // Caller to ensure `s` does not contain a prefix. fn from_hex_internal(s: &str) -> Result { - let (high, low) = if s.len() < 32 { + let (high, low) = if s.len() <= 32 { let low = parse::hex_u128_unchecked(s)?; (0, low) } else {