From dbf98175bae34751c0bd26f197a386171ec602f5 Mon Sep 17 00:00:00 2001 From: Alexandre Huff Date: Thu, 9 Jan 2025 20:16:52 -0300 Subject: [PATCH] asn1: fix for byte buffer to uint64_t helper Signed-off-by: Alexandre Huff --- lib/asn1/asn1_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asn1/asn1_utils.cpp b/lib/asn1/asn1_utils.cpp index 9732f41c759..d3be1974218 100644 --- a/lib/asn1/asn1_utils.cpp +++ b/lib/asn1/asn1_utils.cpp @@ -957,7 +957,7 @@ uint64_t octet_string_helper::to_uint(const byte_buffer& buf) uint64_t val = 0; auto it = buf.begin(); for (unsigned i = 0; i < nbytes; ++i) { - val += static_cast(*it) << static_cast((nbytes - 1 - i) * 8U); + val |= (static_cast(*it) & 0xffu) << static_cast(i * 8U); ++it; } return val;