From 1df8d1146afec25f0923bf4d05ffe8c9f6b319ee Mon Sep 17 00:00:00 2001 From: yezhiwei Date: Wed, 18 May 2022 11:38:09 +0800 Subject: [PATCH] fix global-buffer-overflow of fix_paths --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61b328541a90..52b492a3c603 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8327,7 +8327,7 @@ static int fix_paths(void) my_realpath(mysql_home,mysql_home,MYF(0)); /* Ensure that mysql_home ends in FN_LIBCHAR */ pos=strend(mysql_home); - if (pos[-1] != FN_LIBCHAR) + if (mysql_home == pos || pos[-1] != FN_LIBCHAR) { pos[0]= FN_LIBCHAR; pos[1]= 0;