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) ...@@ -805,10 +805,12 @@ static char *read_link_file(const char *link_filepath)
{ {
/* Trim whitespace from end of filepath */ /* Trim whitespace from end of filepath */
len--; len--;
while (filepath[len] >= 0 && filepath[len] <= 0x20) while (static_cast<byte>(filepath[len]) <= 0x20)
filepath[len--]= 0; {
if (!*filepath) if (!len)
return nullptr; return nullptr;
filepath[len--]= 0;
}
/* Ensure that the last 2 path separators are forward slashes, /* Ensure that the last 2 path separators are forward slashes,
because elsewhere we are assuming that tablespace file names end because elsewhere we are assuming that tablespace file names end
in "/databasename/tablename.ibd". */ 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