Skip to content

Commit 2d5e51d

Browse files
committed
fix valgrind warning
1 parent bb2ccc9 commit 2d5e51d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/mysqlnd/mysqlnd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,13 @@ mysqlnd_connect_run_authentication(
506506
size_t plugin_data_len;
507507

508508
plugin_data_len = greet_packet->auth_plugin_data_len;
509-
plugin_data = mnd_emalloc(plugin_data_len);
509+
plugin_data = mnd_emalloc(plugin_data_len + 1);
510510
if (!plugin_data) {
511511
ret = FAIL;
512512
goto end;
513513
}
514514
memcpy(plugin_data, greet_packet->auth_plugin_data, plugin_data_len);
515+
plugin_data[plugin_data_len] = '\0';
515516

516517
requested_protocol = mnd_pestrdup(greet_packet->auth_protocol? greet_packet->auth_protocol: "mysql_native_password", FALSE);
517518
if (!requested_protocol) {

0 commit comments

Comments
 (0)