diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_strex.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_strex.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 7fc14d3296..264ebf2393 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
@@ -74,6 +74,11 @@ | |||
74 | 74 | ||
75 | #define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) | 75 | #define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) |
76 | 76 | ||
77 | #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ | ||
78 | ASN1_STRFLGS_ESC_QUOTE | \ | ||
79 | ASN1_STRFLGS_ESC_CTRL | \ | ||
80 | ASN1_STRFLGS_ESC_MSB) | ||
81 | |||
77 | 82 | ||
78 | /* Three IO functions for sending data to memory, a BIO and | 83 | /* Three IO functions for sending data to memory, a BIO and |
79 | * and a FILE pointer. | 84 | * and a FILE pointer. |
@@ -148,6 +153,13 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch | |||
148 | if(!io_ch(arg, tmphex, 3)) return -1; | 153 | if(!io_ch(arg, tmphex, 3)) return -1; |
149 | return 3; | 154 | return 3; |
150 | } | 155 | } |
156 | /* If we get this far and do any escaping at all must escape | ||
157 | * the escape character itself: backslash. | ||
158 | */ | ||
159 | if (chtmp == '\\' && flags & ESC_FLAGS) { | ||
160 | if(!io_ch(arg, "\\\\", 2)) return -1; | ||
161 | return 2; | ||
162 | } | ||
151 | if(!io_ch(arg, &chtmp, 1)) return -1; | 163 | if(!io_ch(arg, &chtmp, 1)) return -1; |
152 | return 1; | 164 | return 1; |
153 | } | 165 | } |
@@ -292,11 +304,6 @@ static const signed char tag2nbyte[] = { | |||
292 | 4, -1, 2 /* 28-30 */ | 304 | 4, -1, 2 /* 28-30 */ |
293 | }; | 305 | }; |
294 | 306 | ||
295 | #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ | ||
296 | ASN1_STRFLGS_ESC_QUOTE | \ | ||
297 | ASN1_STRFLGS_ESC_CTRL | \ | ||
298 | ASN1_STRFLGS_ESC_MSB) | ||
299 | |||
300 | /* This is the main function, print out an | 307 | /* This is the main function, print out an |
301 | * ASN1_STRING taking note of various escape | 308 | * ASN1_STRING taking note of various escape |
302 | * and display options. Returns number of | 309 | * and display options. Returns number of |