shell32: Check array index limit first.

Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrey Gusev 2018-05-14 14:20:35 +03:00 committed by Alexandre Julliard
parent 40b211b6c2
commit 0dddf2a1ac
2 changed files with 2 additions and 2 deletions

View File

@ -613,7 +613,7 @@ static LPWSTR Stream_LoadPath( LPCSTR p, DWORD maxlen )
int len = 0, wlen;
LPWSTR path;
while( p[len] && (len < maxlen) )
while( (len < maxlen) && p[len] )
len++;
wlen = MultiByteToWideChar(CP_ACP, 0, p, len, NULL, 0);

View File

@ -341,7 +341,7 @@ static int dskentry_decode(const char *value, int len, char *output)
while (pos<len)
{
char c;
if (value[pos] == '\\' && pos<len-1)
if (pos<len-1 && value[pos] == '\\')
{
pos++;
switch (value[pos])