summaryrefslogtreecommitdiff
path: root/sql/discover.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/discover.cc')
-rw-r--r--sql/discover.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/discover.cc b/sql/discover.cc
index 82648e94bc5..d8ed718fc58 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -199,14 +199,15 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta,
end= cur + dirp->number_of_files;
while (cur < end)
{
- char *octothorp= strrchr(cur->name + 1, '#');
+ char *octothorp= strchr(cur->name + 1, '#');
char *ext= strchr(octothorp ? octothorp : cur->name, FN_EXTCHAR);
if (ext)
{
size_t len= (octothorp ? octothorp : ext) - cur->name;
if (from != cur &&
- (my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) ||
+ (strlen(from->name) <= len ||
+ my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) ||
(from->name[len] != FN_EXTCHAR && from->name[len] != '#')))
advance(from, to, cur, skip);