summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-07-31 09:48:27 +0000
committertb <>2022-07-31 09:48:27 +0000
commitb26b0c542d8a2430c8380648c04e453170dfa3d9 (patch)
tree6e24c08efa00ef0cbc3d992eb2ab8dcf112899e4 /src
parentadfeaa72918ca3bc0230a94687ef86320bca9ae4 (diff)
downloadopenbsd-b26b0c542d8a2430c8380648c04e453170dfa3d9.tar.gz
openbsd-b26b0c542d8a2430c8380648c04e453170dfa3d9.tar.bz2
openbsd-b26b0c542d8a2430c8380648c04e453170dfa3d9.zip
Allow a NULL header in PEM_write{,_bio}()
When PEM_write{,_bio}() were documented by Rich Salz and Richard Levitte, it was incorrectly stated that the header argument is allowed to be NULL. This was never true. Instead of fixing the documentation, it was decided that the API needs a fix, so pull in a variant of OpenSSL 3b9082c8. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index 7b7f81092e..7076023eba 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_lib.c,v 1.50 2021/12/12 21:30:14 tb Exp $ */ 1/* $OpenBSD: pem_lib.c,v 1.51 2022/07/31 09:48:27 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -608,8 +608,7 @@ PEM_write_bio(BIO *bp, const char *name, const char *header,
608 (BIO_write(bp, "-----\n", 6) != 6)) 608 (BIO_write(bp, "-----\n", 6) != 6))
609 goto err; 609 goto err;
610 610
611 i = strlen(header); 611 if (header != NULL && (i = strlen(header)) > 0) {
612 if (i > 0) {
613 if ((BIO_write(bp, header, i) != i) || 612 if ((BIO_write(bp, header, i) != i) ||
614 (BIO_write(bp, "\n", 1) != 1)) 613 (BIO_write(bp, "\n", 1) != 1))
615 goto err; 614 goto err;