From: tb Date: Fri, 24 Aug 2018 19:48:39 +0000 (+0000) Subject: Check return value of EVP_EncodeUpdate() in PEM_write_bio(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4256894af567b9e26b42a23caa47bf237dc4c629;p=openbsd Check return value of EVP_EncodeUpdate() in PEM_write_bio(). ok jsing --- diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c index bffd1fa9540..6661a222f00 100644 --- a/lib/libcrypto/pem/pem_lib.c +++ b/lib/libcrypto/pem/pem_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_lib.c,v 1.47 2018/05/13 10:47:54 tb Exp $ */ +/* $OpenBSD: pem_lib.c,v 1.48 2018/08/24 19:48:39 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -613,7 +613,8 @@ PEM_write_bio(BIO *bp, const char *name, const char *header, i = j = 0; while (len > 0) { n = (int)((len > (PEM_BUFSIZE * 5)) ? (PEM_BUFSIZE * 5) : len); - EVP_EncodeUpdate(&ctx, buf, &outl, &(data[j]), n); + if (!EVP_EncodeUpdate(&ctx, buf, &outl, &(data[j]), n)) + goto err; if ((outl) && (BIO_write(bp, (char *)buf, outl) != outl)) goto err; i += outl;