Commit e58a67e9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Avoid accessing memory before the left hand string in compare_substring.

parent c5ef45e5
......@@ -462,11 +462,21 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
case COND_LHS:
return 0 == strncmpW( a, b, lstrlenW( b ) );
case COND_RHS:
return 0 == lstrcmpW( a + (lstrlenW( a ) - lstrlenW( b )), b );
{
int l = lstrlenW( a );
int r = lstrlenW( b );
if (r > l) return 0;
return 0 == lstrcmpW( a + (l - r), b );
}
case COND_ILHS:
return 0 == strncmpiW( a, b, lstrlenW( b ) );
case COND_IRHS:
return 0 == lstrcmpiW( a + (lstrlenW( a ) - lstrlenW( b )), b );
{
int l = lstrlenW( a );
int r = lstrlenW( b );
if (r > l) return 0;
return 0 == lstrcmpiW( a + (l - r), b );
}
default:
ERR("invalid substring operator\n");
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment