mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix accesses to uninitialized memory (found by valgrind)
This commit is contained in:
@ -948,11 +948,12 @@ frm_type_enum mysql_frm_type(char *path)
|
||||
{
|
||||
DBUG_RETURN(FRMTYPE_ERROR);
|
||||
}
|
||||
length= my_read(file, (byte*) header, 10, MYF(MY_WME));
|
||||
length= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME));
|
||||
my_close(file, MYF(MY_WME));
|
||||
if (length == (int) MY_FILE_ERROR)
|
||||
DBUG_RETURN(FRMTYPE_ERROR);
|
||||
if (!strncmp(header, "TYPE=VIEW\n", 10))
|
||||
if (length < (int) sizeof(header) ||
|
||||
!strncmp(header, "TYPE=VIEW\n", sizeof(header)))
|
||||
DBUG_RETURN(FRMTYPE_VIEW);
|
||||
DBUG_RETURN(FRMTYPE_TABLE); // Is probably a .frm table
|
||||
}
|
||||
|
Reference in New Issue
Block a user