File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -785,18 +785,20 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
785
785
charset_hint = Z_STRVAL_P (uf_result );
786
786
len = Z_STRLEN_P (uf_result );
787
787
788
- if (len == 4 ) { /* sizeof(none|auto|pass)-1 */
789
- if (!memcmp ("pass" , charset_hint , sizeof ("pass" ) - 1 ) ||
790
- !memcmp ("auto" , charset_hint , sizeof ("auto" ) - 1 ) ||
791
- !memcmp ("none" , charset_hint , sizeof ("none" ) - 1 )) {
792
-
793
- charset_hint = NULL ;
794
- len = 0 ;
788
+ if (charset_hint != NULL && len != 0 ) {
789
+ if (len == 4 ) { /* sizeof(none|auto|pass)-1 */
790
+ if (!memcmp ("pass" , charset_hint , sizeof ("pass" ) - 1 ) ||
791
+ !memcmp ("auto" , charset_hint , sizeof ("auto" ) - 1 ) ||
792
+ !memcmp ("none" , charset_hint , sizeof ("none" ) - 1 )) {
793
+
794
+ charset_hint = NULL ;
795
+ len = 0 ;
796
+ }
797
+ } else {
798
+ /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
799
+ Otherwise try default_charset next */
800
+ goto det_charset ;
795
801
}
796
- } else {
797
- /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
798
- Otherwise try default_charset next */
799
- goto det_charset ;
800
802
}
801
803
}
802
804
}
You can’t perform that action at this time.
0 commit comments