Andrey Gusev : shell32: Check array index limit first.

Alexandre Julliard julliard at winehq.org
Tue May 15 16:25:22 CDT 2018


Module: wine
Branch: master
Commit: 0dddf2a1ac2151f0e3369de918d041bd83cd601d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0dddf2a1ac2151f0e3369de918d041bd83cd601d

Author: Andrey Gusev <andrey.goosev at gmail.com>
Date:   Mon May 14 14:20:35 2018 +0300

shell32: Check array index limit first.

Signed-off-by: Andrey Gusev <andrey.goosev at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/shelllink.c | 2 +-
 dlls/shell32/xdg.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 07c83d1..0380ac9 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -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);
diff --git a/dlls/shell32/xdg.c b/dlls/shell32/xdg.c
index 622ef34..781902a 100644
--- a/dlls/shell32/xdg.c
+++ b/dlls/shell32/xdg.c
@@ -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])




More information about the wine-cvs mailing list