The PEM(3) manual page specifies a way to read a certificate in PEM format from a BIO:
=== cut === Although the PEM routines take several arguments in almost all applications most of them are set to 0 or NULL.
Read a certificate in PEM format from a BIO:
X509 *x; x = PEM_read_bio(bp, NULL, 0, NULL); if (x == NULL) { /* Error */ } === cut ===
It is erroneous and misleading because 1. There is no PEM_read_bio() function described in that manual page. 2. The actual PEM_read_bio() declaration is
int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len);
which does not have the semantics compatible with the usage case wshown in the manual page.
Surprisingly though, if there is no "-----BEGIN " sequence in the provided BIO pointer bp, the PEM_read_bio() _will_ return 0, and x==NULL will be evaluated to true. Hovewer, if bp contains the valid PEM data, the program will just crash because of unchecked
*name=nameB->data;
in the PEM_read_bio() implementation.
-- Lev Walkin [EMAIL PROTECTED]
______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]