summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_old_lib.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/asn1/asn1_old_lib.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_old_lib.c b/src/lib/libcrypto/asn1/asn1_old_lib.c
index e41a5ea257..a4d3cc71b4 100644
--- a/src/lib/libcrypto/asn1/asn1_old_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_old_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_old_lib.c,v 1.3 2022/01/14 07:57:17 tb Exp $ */ 1/* $OpenBSD: asn1_old_lib.c,v 1.4 2022/05/05 19:18:56 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 *
@@ -72,8 +72,9 @@ ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
72 int *pclass, long omax) 72 int *pclass, long omax)
73{ 73{
74 int constructed, indefinite; 74 int constructed, indefinite;
75 uint32_t tag_number, length; 75 uint32_t tag_number;
76 uint8_t tag_class; 76 uint8_t tag_class;
77 size_t length;
77 CBS cbs; 78 CBS cbs;
78 int ret = 0; 79 int ret = 0;
79 80
@@ -99,7 +100,7 @@ ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
99 * signal an error by setting the 8th bit in the return value... but we 100 * signal an error by setting the 8th bit in the return value... but we
100 * still provide all of the decoded data. 101 * still provide all of the decoded data.
101 */ 102 */
102 if (length > CBS_len(&cbs)) { 103 if (length > CBS_len(&cbs) || length > LONG_MAX) {
103 ASN1error(ASN1_R_TOO_LONG); 104 ASN1error(ASN1_R_TOO_LONG);
104 ret = 0x80; 105 ret = 0x80;
105 } 106 }