diff options
author | unknown <monty@mysql.com> | 2005-01-13 03:02:49 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-01-13 03:02:49 +0200 |
commit | 90b9065dce225bdc3844aaa1b15fe110e1eaa2fa (patch) | |
tree | a3c2244375497d36d806624e45257ec4d81d9438 /sql/sql_view.cc | |
parent | a21bb5754663a80115fd2e4d0284c356a8e44f09 (diff) | |
download | mariadb-git-90b9065dce225bdc3844aaa1b15fe110e1eaa2fa.tar.gz |
Fix accesses to uninitialized memory (found by valgrind)
mysys/my_alloc.c:
Added comment for free_root
sql/filesort.cc:
Removed valgrind warning
sql/sql_select.cc:
Remove not needed my_casedn_str() for internal files
(Old code actually didn't do any god as it was accessing not used memory)
sql/sql_view.cc:
Removed access to uninitialized memory
sql/table.cc:
Cleanup of error handling
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 533876b6718..e2c4b1289fd 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -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 } |