]> granicus.if.org Git - php/commitdiff
check the validity of the parameter
authorAndrey Hristov <andrey@php.net>
Mon, 4 Feb 2013 13:27:56 +0000 (14:27 +0100)
committerAndrey Hristov <andrey@php.net>
Mon, 4 Feb 2013 13:27:56 +0000 (14:27 +0100)
ext/mysqlnd/mysqlnd.c

index 0b81ac99fa2b8ac9504c318d38494612558b3899..90c2b73eaed94444ed0821548fffc9596dd16d3b 100644 (file)
@@ -2321,7 +2321,14 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
                        break;
                case MYSQL_SET_CHARSET_NAME:
                {
-                       char * new_charset_name = mnd_pestrdup(value, conn->persistent);
+                       char * new_charset_name;
+                       if (!mysqlnd_find_charset_name(value)) {
+                               SET_CLIENT_ERROR(*conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Unknown character set");
+                               ret = FAIL;
+                               break;
+                       }
+                               
+                       new_charset_name = mnd_pestrdup(value, conn->persistent);
                        if (!new_charset_name) {
                                goto oom;
                        }