From 37c0f0cf1a98e46bd21e3dfa267ff97cd4130f12 Mon Sep 17 00:00:00 2001 From: Sertonix Date: Wed, 26 Mar 2025 12:36:45 +0000 Subject: [PATCH] Fix BioByteArray when char is not signed char can be signed or unsigned depending on the arch and compiler flags. Use unsigned char explicitly to behave consistently. Fixes 70788535732e Consolidate Bignum2ByteArray conversion implementations --- lib/BioByteArray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/BioByteArray.cpp b/lib/BioByteArray.cpp index c77c18d8..69ae5631 100644 --- a/lib/BioByteArray.cpp +++ b/lib/BioByteArray.cpp @@ -18,7 +18,7 @@ BioByteArray::BioByteArray(const BIGNUM *bn, int bits) store.resize(BN_num_bytes(bn)); BN_bn2bin(bn, (unsigned char *)store.data()); openssl_error(); - if (store.size() > 0 && (char)store[0] < 0) + if (store.size() > 0 && (unsigned char)store[0] >= 0x80) store.prepend('\0'); if (len > 0 && store.size() < len) store.prepend(len - store.size(), 0);