Index: openssl/crypto/asn1/a_strex.c |
=================================================================== |
--- openssl/crypto/asn1/a_strex.c (revision 105093) |
+++ openssl/crypto/asn1/a_strex.c (working copy) |
@@ -74,7 +74,12 @@ |
#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) |
+#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ |
+ ASN1_STRFLGS_ESC_QUOTE | \ |
+ ASN1_STRFLGS_ESC_CTRL | \ |
+ ASN1_STRFLGS_ESC_MSB) |
+ |
/* Three IO functions for sending data to memory, a BIO and |
* and a FILE pointer. |
*/ |
@@ -148,6 +153,13 @@ |
if(!io_ch(arg, tmphex, 3)) return -1; |
return 3; |
} |
+ /* If we get this far and do any escaping at all must escape |
+ * the escape character itself: backslash. |
+ */ |
+ if (chtmp == '\\' && flags & ESC_FLAGS) { |
+ if(!io_ch(arg, "\\\\", 2)) return -1; |
+ return 2; |
+ } |
if(!io_ch(arg, &chtmp, 1)) return -1; |
return 1; |
} |
@@ -292,11 +304,6 @@ |
4, -1, 2 /* 28-30 */ |
}; |
-#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ |
- ASN1_STRFLGS_ESC_QUOTE | \ |
- ASN1_STRFLGS_ESC_CTRL | \ |
- ASN1_STRFLGS_ESC_MSB) |
- |
/* This is the main function, print out an |
* ASN1_STRING taking note of various escape |
* and display options. Returns number of |