mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +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:
@ -742,7 +742,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
!(sql_field->charset= get_charset_by_csname(sql_field->charset->csname,
|
||||
MY_CS_BINSORT,MYF(0))))
|
||||
{
|
||||
char tmp[64];
|
||||
char tmp[65];
|
||||
strmake(strmake(tmp, save_cs->csname, sizeof(tmp)-4),
|
||||
STRING_WITH_LEN("_bin"));
|
||||
my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp);
|
||||
|
Reference in New Issue
Block a user