Prevents memory underflow in GFileMimeType() in gutils/fsys.c#5018
Prevents memory underflow in GFileMimeType() in gutils/fsys.c#5018jtanx merged 1 commit intofontforge:masterfrom
Conversation
|
Are you sure that's where it's crashing? strrchr gets the last occurrence, so it seems to me that |
Or "a.". @Omnikron13 I think the easy fix here is to remove what you added and then below at the start of the to something like |
Just Files with single character extensions like I believe that just this: Should be sufficient to handle it that way. Is there a particular reason to return The only concern I can think of is that this would misidentify any file that ends with just |
| int len = strlen(pt); | ||
|
|
||
| // Handle the .. 'directory'. Prevents underflowing below | ||
| if(len < 1) |
There was a problem hiding this comment.
Don't think this is correct, what if you had a file named foo..
Can you just change the below check to if(len > 0 && pt[len - 1] == '~')
Short-circuits out the function in the specific case of '..', which was under-flowing the later check
if (pt[len - 1] == '~')Type of change