mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Fixes segfault occurrence in PEM_write()
Checks if header is NULL or not before calling strlen(). CLA: trivial Fixes #18825 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18865)
This commit is contained in:
parent
df274c334c
commit
205957405d
@ -624,7 +624,7 @@ int PEM_write_bio(BIO *bp, const char *name, const char *header,
|
||||
(BIO_write(bp, "-----\n", 6) != 6))
|
||||
goto err;
|
||||
|
||||
i = strlen(header);
|
||||
i = header != NULL ? strlen(header) : 0;
|
||||
if (i > 0) {
|
||||
if ((BIO_write(bp, header, i) != i) || (BIO_write(bp, "\n", 1) != 1))
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user