diff options
author | Richard Levitte <levitte@openssl.org> | 2001-10-11 19:38:40 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-10-11 19:38:40 +0000 |
commit | 67d0738aba4988a239d57f6cd7aa36cf27df1f92 (patch) | |
tree | 9f9e138bb13bf27d6d1e292287826f9a6f15da3a /crypto/evp/bio_b64.c | |
parent | b8a61e736299a93cf3c4b69ce1c94406fff0be5a (diff) |
In certain cases, no encoding has been set up for the b64 filter. In
such cases, a flush should *not* attempt to finalise the encoding, as
the EVP_ENCODE_CTX structure will only be filled with garbage. For
the same reason, do the same check when a wpending is performed.
Diffstat (limited to 'crypto/evp/bio_b64.c')
-rw-r--r-- | crypto/evp/bio_b64.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index af6fa2ae8f..f12eac1b55 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -465,7 +465,8 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) break; case BIO_CTRL_WPENDING: /* More to write in buffer */ ret=ctx->buf_len-ctx->buf_off; - if ((ret == 0) && (ctx->base64.num != 0)) + if ((ret == 0) && (ctx->encode != B64_NONE) + && (ctx->base64.num != 0)) ret=1; else if (ret <= 0) ret=BIO_ctrl(b->next_bio,cmd,num,ptr); @@ -500,7 +501,7 @@ again: goto again; } } - else if (ctx->base64.num != 0) + else if (ctx->encode != B64_NONE && ctx->base64.num != 0) { ctx->buf_off=0; EVP_EncodeFinal(&(ctx->base64), |