1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Follow up fix for CONC-696

According to next_thread_id() in mysqld.cc the
thread id is limited to 4 bytes. Thanks to Vlad
for pointing out
This commit is contained in:
Georg Richter
2024-05-14 09:45:51 +02:00
parent d5394838fd
commit 6bd5b6746f

View File

@@ -2785,11 +2785,15 @@ mysql_refresh(MYSQL *mysql,uint options)
int STDCALL
mysql_kill(MYSQL *mysql,ulong pid)
{
char buff[26];
char buff[16];
/* process id can't be larger than 4-bytes */
if (pid & (~0xFFFFFFFFUL))
snprintf(buff, sizeof buff, "KILL %llu", (ulonglong)pid);
else
{
my_set_error(mysql, CR_CONNECTION_ERROR, SQLSTATE_UNKNOWN, 0);
return 1;
}
snprintf(buff, sizeof buff, "KILL %lu", pid);
return mysql_real_query(mysql, (char *)buff, (ulong)strlen(buff));
}