summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2016-10-02 20:45:04 +0000
committerguenther <>2016-10-02 20:45:04 +0000
commit32f9250f554f0962dd3dce5496156b8c315715ca (patch)
treecb476b84258f99e15ef4426f1342eaa9cb189fa2
parenta509579805fb978fedfefe80166025041fef1e4c (diff)
downloadopenbsd-32f9250f554f0962dd3dce5496156b8c315715ca.tar.gz
openbsd-32f9250f554f0962dd3dce5496156b8c315715ca.tar.bz2
openbsd-32f9250f554f0962dd3dce5496156b8c315715ca.zip
In X509_cmp_time(), pass asn1_time_parse() the tag of the field being
parsed so that a malformed GeneralizedTime field is recognized as an error instead of potentially being interpreted as if it was a valid UTCTime. Reported by Theofilos Petsios (theofilos (at) cs.columbia.edu) ok beck@ tedu@ jsing@
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 5c043aa7b1..a9330e1c03 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vfy.c,v 1.49 2016/03/11 07:08:45 mmcc Exp $ */ 1/* $OpenBSD: x509_vfy.c,v 1.50 2016/10/02 20:45:04 guenther Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1658,7 +1658,8 @@ X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time)
1658 1658
1659 memset(&tm1, 0, sizeof(tm1)); 1659 memset(&tm1, 0, sizeof(tm1));
1660 1660
1661 if ((type = asn1_time_parse(ctm->data, ctm->length, &tm1, 0)) == -1) 1661 type = asn1_time_parse(ctm->data, ctm->length, &tm1, ctm->type);
1662 if (type == -1)
1662 goto out; /* invalid time */ 1663 goto out; /* invalid time */
1663 1664
1664 /* RFC 5280 section 4.1.2.5 */ 1665 /* RFC 5280 section 4.1.2.5 */