diff --git a/libi2pd/Crypto.cpp b/libi2pd/Crypto.cpp index 376aec89..ccb96468 100644 --- a/libi2pd/Crypto.cpp +++ b/libi2pd/Crypto.cpp @@ -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);