charset_hint = Z_STRVAL_P(uf_result);
len = Z_STRLEN_P(uf_result);
- if (len == 4) { /* sizeof(none|auto|pass)-1 */
- if (!memcmp("pass", charset_hint, sizeof("pass") - 1) ||
- !memcmp("auto", charset_hint, sizeof("auto") - 1) ||
- !memcmp("none", charset_hint, sizeof("none") - 1)) {
-
- charset_hint = NULL;
- len = 0;
+ if (charset_hint != NULL && len != 0) {
+ if (len == 4) { /* sizeof(none|auto|pass)-1 */
+ if (!memcmp("pass", charset_hint, sizeof("pass") - 1) ||
+ !memcmp("auto", charset_hint, sizeof("auto") - 1) ||
+ !memcmp("none", charset_hint, sizeof("none") - 1)) {
+
+ charset_hint = NULL;
+ len = 0;
+ }
+ } else {
+ /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
+ Otherwise try default_charset next */
+ goto det_charset;
}
- } else {
- /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
- Otherwise try default_charset next */
- goto det_charset;
}
}
}