mirror of
https://github.com/Ed94/metadesk.git
synced 2026-06-12 23:51:37 -07:00
Fix overflow bug with MD_StringMatchFlag_RightSideSloppy
If a is longer than b, then MD_S8Match will check outside of b's bounds.
This commit is contained in:
+1
-1
@@ -958,7 +958,7 @@ MD_S8Match(MD_String8 a, MD_String8 b, MD_MatchFlags flags)
|
||||
if(a.size == b.size || flags & MD_StringMatchFlag_RightSideSloppy)
|
||||
{
|
||||
result = 1;
|
||||
for(MD_u64 i = 0; i < a.size; i += 1)
|
||||
for(MD_u64 i = 0; i < a.size && i < b.size; i += 1)
|
||||
{
|
||||
MD_b32 match = (a.str[i] == b.str[i]);
|
||||
if(flags & MD_StringMatchFlag_CaseInsensitive)
|
||||
|
||||
Reference in New Issue
Block a user