]> granicus.if.org Git - php/commitdiff
fix Bug #62273 Segmentation Fault in Mysqli/Mysqlnd
authorandrey <andrey@php.net>
Fri, 29 Jun 2012 11:42:36 +0000 (14:42 +0300)
committerandrey <andrey@php.net>
Fri, 29 Jun 2012 11:42:36 +0000 (14:42 +0300)
ext/mysqlnd/mysqlnd.c

index cc2dd06c3183afd34e084a4f5a9b9f6d8725f0e3..b539c5180cac20fd2725396c7d89e500fb04dc62 100644 (file)
@@ -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;