Fix incorrect handling of special characters
authorLutz Jänicke <jaenicke@openssl.org>
Wed, 21 Feb 2007 17:44:53 +0000 (17:44 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Wed, 21 Feb 2007 17:44:53 +0000 (17:44 +0000)
PR: 1459
Submitted by: tnitschke@innominate.com
Reviewed by: steve@openssl.org

crypto/asn1/a_strex.c

index fc743c2ad08052b70e60727b67e303f8fdf83647..c2dbb6f9a58d3dd60e7c9e012b5167e7d13f8db5 100644 (file)
@@ -170,7 +170,7 @@ static int do_buf(unsigned char *buf, int buflen,
        q = buf + buflen;
        outlen = 0;
        while(p != q) {
-               if(p == buf) orflags = CHARTYPE_FIRST_ESC_2253;
+               if(p == buf && flags & ASN1_STRFLGS_ESC_2253) orflags = CHARTYPE_FIRST_ESC_2253;
                else orflags = 0;
                switch(type & BUF_TYPE_WIDTH_MASK) {
                        case 4:
@@ -197,7 +197,7 @@ static int do_buf(unsigned char *buf, int buflen,
                        default:
                        return -1;      /* invalid width */
                }
-               if (p == q) orflags = CHARTYPE_LAST_ESC_2253;
+               if (p == q && flags & ASN1_STRFLGS_ESC_2253) orflags = CHARTYPE_LAST_ESC_2253;
                if(type & BUF_TYPE_CONVUTF8) {
                        unsigned char utfbuf[6];
                        int utflen;