mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-12 00:47:49 -04:00
[bugfix] zxbox unsupported files crash OOB access to extension list
invalid files return -1 but thats not checked before accessing invalid array position Change-Id: Ic07cca250e2584e2e95fa7c41085b254f94ad591
This commit is contained in:
parent
7d88ab4ef4
commit
4503d63ec8
1 changed files with 7 additions and 3 deletions
|
|
@ -106,9 +106,13 @@ static int find_extension(const char *ext)
|
|||
void spcf_read_command_line(const void* parameter)
|
||||
{
|
||||
int ix;
|
||||
|
||||
ix = find_extension( parameter - 3 + rb->strlen (parameter) );
|
||||
|
||||
const char *ext = rb->strrchr(parameter, '.');
|
||||
ix = (ext ? find_extension(ext+1) : -1);
|
||||
if (ix < 0)
|
||||
{
|
||||
rb->splash(HZ*2, "Invalid extension");
|
||||
return;
|
||||
}
|
||||
file_type = extensions[ix].type;
|
||||
file_subtype = extensions[ix].subtype;
|
||||
rb->strlcpy(filenamebuf, parameter, MAXFILENAME - 10 + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue