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.
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);
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),