From 6bd5b6746fd4c74401048b242e6c503fb85eb3c5 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Tue, 14 May 2024 09:45:51 +0200 Subject: [PATCH] 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 --- libmariadb/mariadb_lib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libmariadb/mariadb_lib.c b/libmariadb/mariadb_lib.c index 39e69243..482d1911 100644 --- a/libmariadb/mariadb_lib.c +++ b/libmariadb/mariadb_lib.c @@ -2785,12 +2785,16 @@ 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 - snprintf(buff, sizeof buff, "KILL %lu", pid); + { + 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)); }