diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index 966febd056cd126927abc150765485d47441bd4a..0c159a8ccb430d02d3d08e9461569a51b836fb18 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -805,10 +805,12 @@ static char *read_link_file(const char *link_filepath) { /* Trim whitespace from end of filepath */ len--; - while (filepath[len] >= 0 && filepath[len] <= 0x20) + while (static_cast<byte>(filepath[len]) <= 0x20) + { + if (!len) + return nullptr; filepath[len--]= 0; - if (!*filepath) - return nullptr; + } /* Ensure that the last 2 path separators are forward slashes, because elsewhere we are assuming that tablespace file names end in "/databasename/tablename.ibd". */