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

Minimize unsafe C functions usage

Replace calls to `sprintf` and `strcpy` by the safer options `snprintf`
and `safe_strcpy` in the following directories:

- libmysqld
- mysys
- sql-common
- strings

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:
Christian Gonzalez
2023-02-23 22:43:14 +00:00
committed by Andrew Hutchings
parent e240e2749e
commit 8b0f766c6c
9 changed files with 33 additions and 25 deletions

View File

@ -459,7 +459,7 @@ main(int argc, char **argv __attribute__((unused)))
bzero((void*)&all_charsets,sizeof(all_charsets));
bzero((void*) refids, sizeof(refids));
sprintf(filename,"%s/%s",argv[1],"Index.xml");
snprintf(filename,sizeof(filename),"%s/%s",argv[1],"Index.xml");
my_read_charset_file(filename);
for (cs= all_charsets;
@ -470,7 +470,7 @@ main(int argc, char **argv __attribute__((unused)))
{
if ( (!simple_cs_is_full(cs)) && (cs->csname))
{
sprintf(filename,"%s/%s.xml",argv[1],cs->csname);
snprintf(filename,sizeof(filename),"%s/%s.xml",argv[1],cs->csname);
my_read_charset_file(filename);
}
cs->state|= MY_CS_LOADED;