]> granicus.if.org Git - php/commitdiff
Escape trigraph sequence
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 4 Sep 2018 03:07:43 +0000 (05:07 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 4 Sep 2018 03:07:43 +0000 (05:07 +0200)
??= is a trigraph for #, so it needs to be escaped. To stay
consistent I'm escaping all question marks in this literal, even
though one of the latter two would suffice.

ext/iconv/iconv.c

index 38a775c9a8627402fbaad3ce17e1593c7d81d6d4..d1b28c122d6afd868674e8132768dea71b9ccf34 100644 (file)
@@ -1224,7 +1224,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
        do {
                size_t prev_in_left;
                size_t out_size;
-               size_t encoded_word_min_len = sizeof("=??X??=")-1 + out_charset_len + (enc_scheme == PHP_ICONV_ENC_SCHEME_BASE64 ? 4 : 3);
+               size_t encoded_word_min_len = sizeof("=\?\?X\?\?=")-1 + out_charset_len + (enc_scheme == PHP_ICONV_ENC_SCHEME_BASE64 ? 4 : 3);
 
                if (char_cnt < encoded_word_min_len + lfchars_len + 1) {
                        /* lfchars must be encoded in ASCII here*/