]> granicus.if.org Git - php/commitdiff
fix valgrind warning
authorAndrey Hristov <andrey@php.net>
Wed, 4 May 2011 10:35:04 +0000 (10:35 +0000)
committerAndrey Hristov <andrey@php.net>
Wed, 4 May 2011 10:35:04 +0000 (10:35 +0000)
ext/mysqlnd/mysqlnd.c

index 658af75b730c431e415879b736e7c15600ae5b07..61943aa5ffb1b6a6e39e2b6f6ae5c99d2cc9bbcc 100644 (file)
@@ -506,12 +506,13 @@ mysqlnd_connect_run_authentication(
                size_t plugin_data_len;
 
                plugin_data_len = greet_packet->auth_plugin_data_len;
-               plugin_data = mnd_emalloc(plugin_data_len);
+               plugin_data = mnd_emalloc(plugin_data_len + 1);
                if (!plugin_data) {
                        ret = FAIL;
                        goto end;
                }
                memcpy(plugin_data, greet_packet->auth_plugin_data, plugin_data_len);
+               plugin_data[plugin_data_len] = '\0';
 
                requested_protocol = mnd_pestrdup(greet_packet->auth_protocol? greet_packet->auth_protocol: "mysql_native_password", FALSE);
                if (!requested_protocol) {