mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix segfault in find_files if db is NULL and path does not exist or can't be read
In this case, one would end up calling my_error(ER_BAD_DB_ERROR, ...) with a null ptr for DB, which caused a NULL ptr dereference.
This commit is contained in:
@@ -943,7 +943,7 @@ find_files(THD *thd, Dynamic_array<LEX_CSTRING*> *files, LEX_CSTRING *db,
|
|||||||
|
|
||||||
if (!(dirp = my_dir(path, MY_THREAD_SPECIFIC | (db ? 0 : MY_WANT_STAT))))
|
if (!(dirp = my_dir(path, MY_THREAD_SPECIFIC | (db ? 0 : MY_WANT_STAT))))
|
||||||
{
|
{
|
||||||
if (my_errno == ENOENT)
|
if (my_errno == ENOENT && db)
|
||||||
my_error(ER_BAD_DB_ERROR, MYF(0), db->str);
|
my_error(ER_BAD_DB_ERROR, MYF(0), db->str);
|
||||||
else
|
else
|
||||||
my_error(ER_CANT_READ_DIR, MYF(0), path, my_errno);
|
my_error(ER_CANT_READ_DIR, MYF(0), path, my_errno);
|
||||||
|
Reference in New Issue
Block a user