check BIGNUM for null in bn2buf

This commit is contained in:
PobreGato committed 2026-10-06 22:38:56 -04:00
1 parent b7e7b00ab3
commit f438566f53
1 file changed
+1
+1
View File
@@ -130,6 +130,7 @@ namespace crypto
bool bn2buf (const BIGNUM * bn, uint8_t * buf, size_t len)
{
if (!bn) return false; // BN_num_bytes dereferences its argument
int offset = (int)len - (int)BN_num_bytes (bn);
if (offset < 0) return false;
BN_bn2bin (bn, buf + offset);