mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Bug#48983: Bad strmake calls (length one too long)
The problem is a somewhat common misusage of the strmake function. The strmake(dst, src, len) function writes at most /len/ bytes to the string pointed to by src, not including the trailing null byte. Hence, if /len/ is the exact length of the destination buffer, a one byte buffer overflow can occur if the length of the source string is equal to or greater than /len/.
This commit is contained in:
@@ -331,7 +331,7 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
|
||||
|
||||
unix_socket_address.sun_family= AF_UNIX;
|
||||
strmake(unix_socket_address.sun_path, options.socket_file_name,
|
||||
sizeof(unix_socket_address.sun_path));
|
||||
sizeof(unix_socket_address.sun_path) - 1);
|
||||
unlink(unix_socket_address.sun_path); // in case we have stale socket file
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user