diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_strex.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_strex.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 462a4059be..684e933c4f 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #include <openssl/crypto.h> | 62 | #include <openssl/crypto.h> |
| 63 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 64 | #include <openssl/asn1.h> | 64 | #include <openssl/asn1.h> |
| 65 | #include "asn1_locl.h" | ||
| 65 | 66 | ||
| 66 | #include "charmap.h" | 67 | #include "charmap.h" |
| 67 | 68 | ||
| @@ -215,11 +216,15 @@ do_buf(unsigned char *buf, int buflen, int type, unsigned char flags, | |||
| 215 | c |= ((unsigned long)*p++) << 16; | 216 | c |= ((unsigned long)*p++) << 16; |
| 216 | c |= ((unsigned long)*p++) << 8; | 217 | c |= ((unsigned long)*p++) << 8; |
| 217 | c |= *p++; | 218 | c |= *p++; |
| 219 | if (c > UNICODE_MAX || UNICODE_IS_SURROGATE(c)) | ||
| 220 | return -1; | ||
| 218 | break; | 221 | break; |
| 219 | 222 | ||
| 220 | case 2: | 223 | case 2: |
| 221 | c = ((unsigned long)*p++) << 8; | 224 | c = ((unsigned long)*p++) << 8; |
| 222 | c |= *p++; | 225 | c |= *p++; |
| 226 | if (UNICODE_IS_SURROGATE(c)) | ||
| 227 | return -1; | ||
| 223 | break; | 228 | break; |
| 224 | 229 | ||
| 225 | case 1: | 230 | case 1: |
| @@ -240,7 +245,10 @@ do_buf(unsigned char *buf, int buflen, int type, unsigned char flags, | |||
| 240 | if (type & BUF_TYPE_CONVUTF8) { | 245 | if (type & BUF_TYPE_CONVUTF8) { |
| 241 | unsigned char utfbuf[6]; | 246 | unsigned char utfbuf[6]; |
| 242 | int utflen; | 247 | int utflen; |
| 248 | |||
| 243 | utflen = UTF8_putc(utfbuf, sizeof utfbuf, c); | 249 | utflen = UTF8_putc(utfbuf, sizeof utfbuf, c); |
| 250 | if (utflen < 0) | ||
| 251 | return -1; | ||
| 244 | for (i = 0; i < utflen; i++) { | 252 | for (i = 0; i < utflen; i++) { |
| 245 | /* We don't need to worry about setting orflags correctly | 253 | /* We don't need to worry about setting orflags correctly |
| 246 | * because if utflen==1 its value will be correct anyway | 254 | * because if utflen==1 its value will be correct anyway |
