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

@ -3085,7 +3085,7 @@ err:
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
}
else if (info->errmsg != NULL)
strcpy(info->error_text, info->errmsg);
safe_strcpy(info->error_text, sizeof(info->error_text), info->errmsg);
my_message(info->error, info->error_text, MYF(0));