crypto: fix potential null pointer dereference when BIO_meth_new() fails · nodejs/node@3337b09 · GitHub
Skip to content

Commit 3337b09

Browse files
ndosscheaduh95
authored andcommitted
crypto: fix potential null pointer dereference when BIO_meth_new() fails
This function can return null, which will make the calls to BIO_meth_set_* trigger a null deref. Even after fixing this, there is an issue with the `BIOPointer::New(GetMethod())` call in `NodeBIO::New` because the `New` method cannot handle a null pointer despite other code already guarding for this (e.g. the `NodeBIO::New` function already checks `bio`). This patch solves the issues by adding more null checks. PR-URL: #61788 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 46a6192 commit 3337b09

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

deps/ncrypto/ncrypto.cc

Lines changed: 1 addition & 0 deletions

src/crypto/crypto_bio.cc

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)