summaryrefslogtreecommitdiffstats
path: root/crypto/evp/bio_b64.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-25 13:56:44 +0100
committerMatt Caswell <matt@openssl.org>2016-06-16 09:50:48 +0100
commitcf3404fcc77aaf592c95326cbdd25612a8af6878 (patch)
treef85b17508cae4736176c27266148a23f64a7571a /crypto/evp/bio_b64.c
parent2ac6115d9ee35308300b82d96078d03d81e7d320 (diff)
Change the return type of EVP_EncodeUpdate
Previously EVP_EncodeUpdate returned a void. However there are a couple of error conditions that can occur. Therefore the return type has been changed to an int, with 0 indicating error and 1 indicating success. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/bio_b64.c')
-rw-r--r--crypto/evp/bio_b64.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c
index 9067848578..32a884a711 100644
--- a/crypto/evp/bio_b64.c
+++ b/crypto/evp/bio_b64.c
@@ -403,9 +403,10 @@ static int b64_write(BIO *b, const char *in, int inl)
ret += n;
}
} else {
- EVP_EncodeUpdate(ctx->base64,
- (unsigned char *)ctx->buf, &ctx->buf_len,
- (unsigned char *)in, n);
+ if (!EVP_EncodeUpdate(ctx->base64,
+ (unsigned char *)ctx->buf, &ctx->buf_len,
+ (unsigned char *)in, n))
+ return ((ret == 0) ? -1 : ret);
OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf));
OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
ret += n;