Skip to content

Commit

Permalink
make file ending detection slightly more stable
Browse files Browse the repository at this point in the history
currently the tool crashes if the file ending has 5 or more
letters (like .jffs2)
  • Loading branch information
andreasmueller committed Jul 18, 2018
1 parent 40bb62e commit 8664e70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions project.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,17 @@ int GetFileFormatFromExt(const char* csPath)

while(csPath[i] != '.')
{
if (i==0) {
return BIN;
}

i--;
}

if (length-i > 5) {
return BIN;
}

for(j=i;j<length; j++)
{
fmt[j-i]=toupper(csPath[j]);
Expand Down

0 comments on commit 8664e70

Please sign in to comment.