Bug #77711 client crash due to incorrect printf parameters for DBUG_PRINT in client.cc
Submitted: 14 Jul 2015 6:42
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.96 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[14 Jul 2015 6:42] Shane Bester
Description:
Affects debug windows builds of at least 5.0, 5.1, 5.5, 5.6, 5.7, 5.8.
Client crashes here:

0:000> kcn
 # Call Site
00 mysql!strnlen
01 mysql!process_str_arg
02 mysql!my_vsnprintf_ex
03 mysql!my_vsnprintf
04 mysql!DbugVfprintf
05 mysql!_db_doprnt_
06 mysql!mysql_real_connect
07 mysql!sql_real_connect
08 mysql!sql_connect
09 mysql!main
0a mysql!__tmainCRTStartup
0b mysql!mainCRTStartup
0c kernel32!BaseThreadInitThunk
0d ntdll!RtlUserThreadStart

How to repeat:
With a debug build:

mysql.exe -uroot test --default-character-set=utf8 --debug

Suggested fix:
diff --git a/sql-common/client.c b/sql-common/client.c
index 3e4b660..a4aaee6 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -4177,7 +4177,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
                 ("host: '%s'  socket: '%s'  shared memory: %s  have_tcpip: %d",
                  host ? host : "<null>",
                  unix_socket ? unix_socket : "<null>",
-                 (int) mysql->options.shared_memory_base_name,
+                 (char*) mysql->options.shared_memory_base_name,
                  (int) have_tcpip));
       if (mysql->options.protocol == MYSQL_PROTOCOL_MEMORY)
        goto error;

E:\git\mysql-trunk\sql-common>