From 6cfa8128efb13a4c9685a98c10b59f1c880a72c0 Mon Sep 17 00:00:00 2001 From: miod <> Date: Mon, 20 Jul 2015 15:41:48 +0000 Subject: Check the return value of asn1_enc_save(). ok bcook@ doug@ --- src/lib/libcrypto/asn1/tasn_dec.c | 6 ++++-- src/lib/libssl/src/crypto/asn1/tasn_dec.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 7d61a6a233..f08514dc83 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_dec.c,v 1.26 2015/03/19 14:00:22 tedu Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.27 2015/07/20 15:41:48 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -431,8 +431,10 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, } } /* Save encoding */ - if (!asn1_enc_save(pval, *in, p - *in, it)) + if (!asn1_enc_save(pval, *in, p - *in, it)) { + ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_MALLOC_FAILURE); goto auxerr; + } *in = p; if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) goto auxerr; diff --git a/src/lib/libssl/src/crypto/asn1/tasn_dec.c b/src/lib/libssl/src/crypto/asn1/tasn_dec.c index 7d61a6a233..f08514dc83 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_dec.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_dec.c,v 1.26 2015/03/19 14:00:22 tedu Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.27 2015/07/20 15:41:48 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -431,8 +431,10 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, } } /* Save encoding */ - if (!asn1_enc_save(pval, *in, p - *in, it)) + if (!asn1_enc_save(pval, *in, p - *in, it)) { + ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_MALLOC_FAILURE); goto auxerr; + } *in = p; if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) goto auxerr; -- cgit v1.2.3-55-g6feb