diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_enum.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index c7d3a9a0ac..0952e049db 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_enum.c,v 1.19 2018/04/25 11:48:21 tb Exp $ */ | 1 | /* $OpenBSD: a_enum.c,v 1.20 2019/04/28 05:05:56 tb 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 | * |
| @@ -56,6 +56,7 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <limits.h> | ||
| 59 | #include <stdio.h> | 60 | #include <stdio.h> |
| 60 | 61 | ||
| 61 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| @@ -107,7 +108,7 @@ long | |||
| 107 | ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a) | 108 | ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a) |
| 108 | { | 109 | { |
| 109 | int neg = 0, i; | 110 | int neg = 0, i; |
| 110 | long r = 0; | 111 | unsigned long r = 0; |
| 111 | 112 | ||
| 112 | if (a == NULL) | 113 | if (a == NULL) |
| 113 | return (0L); | 114 | return (0L); |
| @@ -128,9 +129,13 @@ ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a) | |||
| 128 | r <<= 8; | 129 | r <<= 8; |
| 129 | r |= (unsigned char)a->data[i]; | 130 | r |= (unsigned char)a->data[i]; |
| 130 | } | 131 | } |
| 132 | |||
| 133 | if (r > LONG_MAX) | ||
| 134 | return -1; | ||
| 135 | |||
| 131 | if (neg) | 136 | if (neg) |
| 132 | r = -r; | 137 | return -(long)r; |
| 133 | return (r); | 138 | return (long)r; |
| 134 | } | 139 | } |
| 135 | 140 | ||
| 136 | ASN1_ENUMERATED * | 141 | ASN1_ENUMERATED * |
