Skip to content

Commit bc2a881

Browse files
committed
crypto: add null check to BIOPointer::New()
This function calls BIO_new() which mustn't receive a null pointer argument. Yet it is able to handle null BIOs gracefully. To solve this, add a null check. Ref: nodejs/node#61788
1 parent c569580 commit bc2a881

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/ncrypto.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ BIOPointer BIOPointer::NewSecMem() {
15151515
}
15161516

15171517
BIOPointer BIOPointer::New(const BIO_METHOD* method) {
1518+
if (method == nullptr) return {};
15181519
return BIOPointer(BIO_new(method));
15191520
}
15201521

0 commit comments

Comments
 (0)