summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrey <andrey@php.net>2012-06-29 14:42:36 +0300
committerandrey <andrey@php.net>2012-06-29 14:42:36 +0300
commit8fe87e7feaab2c031998d553585ba8cabf077499 (patch)
treee6ca5f43a5b4568eac0a77943c75b1409ba71acf
parent1ac611f24f03728e4d9cd717e83331e2e17184d2 (diff)
downloadphp-git-8fe87e7feaab2c031998d553585ba8cabf077499.tar.gz
fix Bug #62273 Segmentation Fault in Mysqli/Mysqlnd
-rw-r--r--ext/mysqlnd/mysqlnd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index cc2dd06c31..b539c5180c 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -680,6 +680,13 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn,
conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent);
conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no);
+ if (!conn->greet_charset) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no);
+ SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE,
+ "Server sent charset unknown to the client. Please, report to the developers");
+ goto err;
+ }
/* we allow load data local infile by default */
mysql_flags |= CLIENT_LOCAL_FILES | CLIENT_PS_MULTI_RESULTS;
mysql_flags |= MYSQLND_CAPABILITIES;