Merge pull request #646 from sertonix/sertonix-patch-1

Fix BioByteArray when char is not signed
This commit is contained in:
Christian Hohnstädt 2025-03-28 10:56:32 +01:00 committed by GitHub
commit 0e65253e21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);