summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2018-05-12 17:39:05 +0000
committerjsing <>2018-05-12 17:39:05 +0000
commit54259dcc7646253fd0374f5fab91657dce17c42e (patch)
tree05e71edebb33bca40adbc313d73a5c26ca173ac9
parent966d6d817fb485a3696e14a84dd77ca88a9ba84a (diff)
downloadopenbsd-54259dcc7646253fd0374f5fab91657dce17c42e.tar.gz
openbsd-54259dcc7646253fd0374f5fab91657dce17c42e.tar.bz2
openbsd-54259dcc7646253fd0374f5fab91657dce17c42e.zip
Add a missing bounds check in c2i_ASN1_BIT_STRING().
This could potentially result in a left shift that exceeded the size of the storage type. Issue found by Simon Friedberger, Robert Merget and Juraj Somorovsky. ok inoguchi@ tb@
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index 8a4a68dbb3..3800c218a1 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_bitstr.c,v 1.25 2018/04/25 11:48:21 tb Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.26 2018/05/12 17:39:05 jsing 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 *
@@ -147,6 +147,11 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len)
147 147
148 p = *pp; 148 p = *pp;
149 i = *(p++); 149 i = *(p++);
150 if (i > 7) {
151 ASN1error(ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
152 goto err;
153 }
154
150 /* We do this to preserve the settings. If we modify 155 /* We do this to preserve the settings. If we modify
151 * the settings, via the _set_bit function, we will recalculate 156 * the settings, via the _set_bit function, we will recalculate
152 * on output */ 157 * on output */