summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-08-24 19:47:26 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-08-24 19:47:26 +0000
commit2eb81aae5232fbe85d0afcc31c6927220c8d4f11 (patch)
treeb1884e4f0c422da0eb5826d12c155f941eb35b86 /lib/libcrypto
parent1f8e2bdb99bab73c08fe7df040673c29ad6da4b8 (diff)
Check return value of EVP_EncodeUpdate() in b64_write().
ok jsing
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/evp/bio_b64.c7
1 files 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;