提交 67d0738a 编写于 作者: R Richard Levitte

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.
上级 b8a61e73
...@@ -465,7 +465,8 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) ...@@ -465,7 +465,8 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
break; break;
case BIO_CTRL_WPENDING: /* More to write in buffer */ case BIO_CTRL_WPENDING: /* More to write in buffer */
ret=ctx->buf_len-ctx->buf_off; 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; ret=1;
else if (ret <= 0) else if (ret <= 0)
ret=BIO_ctrl(b->next_bio,cmd,num,ptr); ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
...@@ -500,7 +501,7 @@ again: ...@@ -500,7 +501,7 @@ again:
goto again; goto again;
} }
} }
else if (ctx->base64.num != 0) else if (ctx->encode != B64_NONE && ctx->base64.num != 0)
{ {
ctx->buf_off=0; ctx->buf_off=0;
EVP_EncodeFinal(&(ctx->base64), EVP_EncodeFinal(&(ctx->base64),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册