Commit f078788e authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-25312 fixup: Fix .isl file parsing

read_link_file(): Avoid GCC -Wtype-limits when char is unsigned,
by always using unsigned comparison. Also, avoid buffer overflow
when the .isl file consists entirely of spaces or control codes.
parent a7d68e7a
......@@ -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)
filepath[len--]= 0;
if (!*filepath)
while (static_cast<byte>(filepath[len]) <= 0x20)
{
if (!len)
return nullptr;
filepath[len--]= 0;
}
/* Ensure that the last 2 path separators are forward slashes,
because elsewhere we are assuming that tablespace file names end
in "/databasename/tablename.ibd". */
......
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