mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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:
committed by
Andrew Hutchings
parent
4911ec1a5b
commit
dc38d8ea80
@ -986,7 +986,7 @@ static int check_connection(THD *thd)
|
||||
/* See RFC 5737, 192.0.2.0/24 is reserved. */
|
||||
const char* fake= "192.0.2.4";
|
||||
inet_pton(AF_INET,fake, ip4);
|
||||
strcpy(ip, fake);
|
||||
safe_strcpy(ip, sizeof(ip), fake);
|
||||
peer_rc= 0;
|
||||
}
|
||||
);
|
||||
@ -1016,7 +1016,7 @@ static int check_connection(THD *thd)
|
||||
ip6->s6_addr[13] = 0x06;
|
||||
ip6->s6_addr[14] = 0x00;
|
||||
ip6->s6_addr[15] = 0x06;
|
||||
strcpy(ip, fake);
|
||||
safe_strcpy(ip, sizeof(ip), fake);
|
||||
peer_rc= 0;
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user