summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-03-15 06:14:03 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-03-15 06:14:03 +0000
commit8dc85461b1e5d3c8bc60bbabeb9b527c63d69d68 (patch)
treeb357a8d5fe89e6b47eace7cfa29793d46c173f16 /lib
parentf4f12490feb2b91ebf2c3338b8c9817e2b0856ad (diff)
Streaming BIOs assume they can write to NULL BIOs
At least SMIME_text() relies on this. Pushing an error on the stack trips PKCS7 regress in py-cryptography, so indicate nothing was written instead of throwing an error. Reported by Alex Gaynor a while back ok jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/bio/bio_lib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c
index 31b1e7305d8..d14507884b9 100644
--- a/lib/libcrypto/bio/bio_lib.c
+++ b/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_lib.c,v 1.43 2022/12/16 13:41:55 schwarze Exp $ */
+/* $OpenBSD: bio_lib.c,v 1.44 2023/03/15 06:14:02 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -380,10 +380,9 @@ BIO_write(BIO *b, const void *in, int inl)
size_t writebytes = 0;
int ret;
- if (b == NULL) {
- BIOerror(ERR_R_PASSED_NULL_PARAMETER);
- return (-1);
- }
+ /* Not an error. Things like SMIME_text() assume that this succeeds. */
+ if (b == NULL)
+ return (0);
if (inl <= 0)
return (0);