From 0e8b19c0157382b66f92f6ab356124f458baf940 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 24 Aug 2018 19:47:25 +0000 Subject: [PATCH] Check return value of EVP_EncodeUpdate() in b64_write(). ok jsing --- lib/libcrypto/evp/bio_b64.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/evp/bio_b64.c b/lib/libcrypto/evp/bio_b64.c index a13d26a8840..82aaa8bf7a2 100644 --- a/lib/libcrypto/evp/bio_b64.c +++ b/lib/libcrypto/evp/bio_b64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_b64.c,v 1.21 2018/05/02 15:51:41 tb Exp $ */ +/* $OpenBSD: bio_b64.c,v 1.22 2018/08/24 19:47:25 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -430,9 +430,10 @@ b64_write(BIO *b, const char *in, int inl) ret += n; } } else { - EVP_EncodeUpdate(&(ctx->base64), + if (!EVP_EncodeUpdate(&(ctx->base64), (unsigned char *)ctx->buf, &ctx->buf_len, - (unsigned char *)in, n); + (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; -- 2.20.1