Dexus / pem

Create private keys and certificates with node.js
Other
570 stars 129 forks source link

Crash in readCertificateInfo API in case of SAN certificate with empty subject field #263

Closed ArikShifer closed 5 years ago

ArikShifer commented 5 years ago

According to the X.509 v3 certificate standard: https://tools.ietf.org/html/rfc5280#section-4.1.2.6 "The subject name MAY be carried in the subject field and/or the subjectAltName extension".

When trying to read certificate info of a SAN certificate with empty subject field, the pem module crash.

Crash traced to null value of tmp in: https://github.com/Dexus/pem/blob/179d2ccebf69c68fab5f765556249e5721f454ce/lib/pem.js#L1003

Quick fix is to execute lines 1003-1081 only when tmp != null