diff options
author | Matt Caswell <matt@openssl.org> | 2018-10-03 15:27:31 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-10-04 14:16:16 +0100 |
commit | d97ce8d9a0619c1d9d1222dc1b44dbebb58dd966 (patch) | |
tree | 176219fbf888f4bd6fac8d4b0fd99d1f7573fb92 /crypto/bio | |
parent | 30699aa1943b10b265c52334d9f582c04c4eccba (diff) |
Fix the BIO callback return code handling
The BIO callback handling incorrectly wrote over the return code passed
to the callback, meaning that an incorrect result was (eventually) returned
to the caller.
Fixes #7343
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7344)
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio_lib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 95eef7d4bf..ca375b911a 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -52,7 +52,7 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len, argi = (int)len; } - if (inret && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) { + if (inret > 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) { if (*processed > INT_MAX) return -1; inret = *processed; @@ -60,7 +60,7 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len, ret = b->callback(b, oper, argp, argi, argl, inret); - if (ret >= 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) { + if (ret > 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) { *processed = (size_t)ret; ret = 1; } |