Skip to content

Commit 8fe87e7

Browse files
committed
fix Bug #62273 Segmentation Fault in Mysqli/Mysqlnd
1 parent 1ac611f commit 8fe87e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/mysqlnd/mysqlnd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,13 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn,
680680
conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent);
681681

682682
conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no);
683+
if (!conn->greet_charset) {
684+
php_error_docref(NULL TSRMLS_CC, E_WARNING,
685+
"Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no);
686+
SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE,
687+
"Server sent charset unknown to the client. Please, report to the developers");
688+
goto err;
689+
}
683690
/* we allow load data local infile by default */
684691
mysql_flags |= CLIENT_LOCAL_FILES | CLIENT_PS_MULTI_RESULTS;
685692
mysql_flags |= MYSQLND_CAPABILITIES;

0 commit comments

Comments
 (0)