summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pkcs7/pk7_doit.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-07-19 18:26:00 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-07-19 18:26:00 +0000
commiteafe1f0cacc5cfeb27ada3c8b89411a0a8ad7e29 (patch)
tree543e6d28df1500c9fca23aa107f31d4ebd82af8d /lib/libcrypto/pkcs7/pk7_doit.c
parentb8ced6fbcc8ba749dd1630246443d23f46b7c8ec (diff)
Verify ASN1 objects types before attempting to access them as a particular
type. ok guenther@ doug@
Diffstat (limited to 'lib/libcrypto/pkcs7/pk7_doit.c')
-rw-r--r--lib/libcrypto/pkcs7/pk7_doit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libcrypto/pkcs7/pk7_doit.c b/lib/libcrypto/pkcs7/pk7_doit.c
index d6fcaca745a..2c69edf4997 100644
--- a/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk7_doit.c,v 1.34 2015/07/18 14:40:59 miod Exp $ */
+/* $OpenBSD: pk7_doit.c,v 1.35 2015/07/19 18:25:59 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1187,6 +1187,8 @@ PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
if (!(astype = get_attribute(sk, NID_pkcs9_messageDigest)))
return NULL;
+ if (astype->type != V_ASN1_OCTET_STRING)
+ return NULL;
return astype->value.octet_string;
}