mirror of
https://github.com/zebrajr/server.git
synced 2025-12-06 00:20:13 +01:00
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.
This commit is contained in:
parent
a7d68e7a0f
commit
f078788e29
|
|
@ -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". */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user