diff options
author | tb <> | 2023-03-04 11:58:29 +0000 |
---|---|---|
committer | tb <> | 2023-03-04 11:58:29 +0000 |
commit | bc26a6ac11ec06332cd7a22391847fa7e02042eb (patch) | |
tree | 7a557b2419c7fd6db0d9f7ae3a87a56dbb91e2bc | |
parent | 4a3fed04f5f73d8364ee7afcae6fe40132f47c20 (diff) | |
download | openbsd-bc26a6ac11ec06332cd7a22391847fa7e02042eb.tar.gz openbsd-bc26a6ac11ec06332cd7a22391847fa7e02042eb.tar.bz2 openbsd-bc26a6ac11ec06332cd7a22391847fa7e02042eb.zip |
Avoid infinite loop in bio_asn1 state machine
If the BIO_write() in the ASN1_STATE_DATA_COPY state fails, incorrect
error handling will break out of the switch without changing the state,
and the infinite for loop will immediately try the same write again,
which is unlikely to succeed... Clearly this code intended to break out
of the loop instead.
Via OpenSSL 1.1 commit 723f616df81ea05f31407f7417f49eea89bb459a
ok millert
-rw-r--r-- | src/lib/libcrypto/asn1/bio_asn1.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c index 9017786f1f..05bc1f7ad3 100644 --- a/src/lib/libcrypto/asn1/bio_asn1.c +++ b/src/lib/libcrypto/asn1/bio_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_asn1.c,v 1.17 2022/01/14 08:40:57 tb Exp $ */ | 1 | /* $OpenBSD: bio_asn1.c,v 1.18 2023/03/04 11:58:29 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -254,7 +254,7 @@ asn1_bio_write(BIO *b, const char *in , int inl) | |||
254 | wrmax = inl; | 254 | wrmax = inl; |
255 | ret = BIO_write(b->next_bio, in, wrmax); | 255 | ret = BIO_write(b->next_bio, in, wrmax); |
256 | if (ret <= 0) | 256 | if (ret <= 0) |
257 | break; | 257 | goto done; |
258 | wrlen += ret; | 258 | wrlen += ret; |
259 | ctx->copylen -= ret; | 259 | ctx->copylen -= ret; |
260 | in += ret; | 260 | in += ret; |