Commit 324d8a60 authored by Vicentiu Ciorbaru's avatar Vicentiu Ciorbaru Committed by Monty

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.
parent 38fe266e
......@@ -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 (my_errno == ENOENT)
if (my_errno == ENOENT && db)
my_error(ER_BAD_DB_ERROR, MYF(0), db->str);
else
my_error(ER_CANT_READ_DIR, MYF(0), path, my_errno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment