1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Minimize unsafe C functions with safe_strcpy()

Similar to #2480.
567b681 introduced safe_strcpy() to minimize the use of C with
potentially unsafe memory overflow with strcpy() whose use is
discouraged.
Replace instances of strcpy() with safe_strcpy() where possible, limited
here to files in the `sql/` directory.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
This commit is contained in:
Robin Newhouse
2023-07-25 20:13:33 +00:00
committed by Andrew Hutchings
parent 4911ec1a5b
commit dc38d8ea80
12 changed files with 50 additions and 41 deletions

View File

@ -2181,7 +2181,7 @@ static int add_keyword_path(String *str, const char *keyword,
const char *path)
{
char temp_path[FN_REFLEN];
strcpy(temp_path, path);
safe_strcpy(temp_path, sizeof(temp_path), path);
#ifdef __WIN__
/* Convert \ to / to be able to create table on unix */
char *pos, *end;