diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/asn1/a_strnid.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 08043f723b..f14daa602c 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_strnid.c,v 1.23 2021/12/11 22:58:48 schwarze Exp $ */ | 1 | /* $OpenBSD: a_strnid.c,v 1.24 2021/12/13 14:06:17 schwarze Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -56,7 +56,10 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <errno.h> | ||
60 | #include <limits.h> | ||
59 | #include <stdio.h> | 61 | #include <stdio.h> |
62 | #include <stdlib.h> | ||
60 | #include <string.h> | 63 | #include <string.h> |
61 | 64 | ||
62 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
@@ -106,11 +109,17 @@ ASN1_STRING_set_default_mask_asc(const char *p) | |||
106 | { | 109 | { |
107 | unsigned long mask; | 110 | unsigned long mask; |
108 | char *end; | 111 | char *end; |
112 | int save_errno; | ||
109 | 113 | ||
110 | if (strncmp(p, "MASK:", 5) == 0) { | 114 | if (strncmp(p, "MASK:", 5) == 0) { |
111 | if (p[5] == '\0') | 115 | if (p[5] == '\0') |
112 | return 0; | 116 | return 0; |
117 | save_errno = errno; | ||
118 | errno = 0; | ||
113 | mask = strtoul(p + 5, &end, 0); | 119 | mask = strtoul(p + 5, &end, 0); |
120 | if (errno == ERANGE && mask == ULONG_MAX) | ||
121 | return 0; | ||
122 | errno = save_errno; | ||
114 | if (*end != '\0') | 123 | if (*end != '\0') |
115 | return 0; | 124 | return 0; |
116 | } else if (strcmp(p, "nombstr") == 0) | 125 | } else if (strcmp(p, "nombstr") == 0) |