diff options
| author | tb <> | 2023-03-15 06:14:02 +0000 |
|---|---|---|
| committer | tb <> | 2023-03-15 06:14:02 +0000 |
| commit | 3bd54020171e9b2e7330ee5ed831533a5344cee8 (patch) | |
| tree | d815d1a839f63dcef24b93e7a0b05d53dd6956dd /src/lib/libcrypto/bio/bio_lib.c | |
| parent | d3cf2a2533c22b330e12679aad10a700eb6fc870 (diff) | |
| download | openbsd-3bd54020171e9b2e7330ee5ed831533a5344cee8.tar.gz openbsd-3bd54020171e9b2e7330ee5ed831533a5344cee8.tar.bz2 openbsd-3bd54020171e9b2e7330ee5ed831533a5344cee8.zip | |
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 '')
| -rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 31b1e7305d..d14507884b 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_lib.c,v 1.43 2022/12/16 13:41:55 schwarze Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.44 2023/03/15 06:14:02 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 | * |
| @@ -380,10 +380,9 @@ BIO_write(BIO *b, const void *in, int inl) | |||
| 380 | size_t writebytes = 0; | 380 | size_t writebytes = 0; |
| 381 | int ret; | 381 | int ret; |
| 382 | 382 | ||
| 383 | if (b == NULL) { | 383 | /* Not an error. Things like SMIME_text() assume that this succeeds. */ |
| 384 | BIOerror(ERR_R_PASSED_NULL_PARAMETER); | 384 | if (b == NULL) |
| 385 | return (-1); | 385 | return (0); |
| 386 | } | ||
| 387 | 386 | ||
| 388 | if (inl <= 0) | 387 | if (inl <= 0) |
| 389 | return (0); | 388 | return (0); |
