user32: Check return value of sscanf (try 2)

André Hentschel nerv at dawncrow.de
Wed Feb 26 16:00:59 CST 2014


Bad matches could return EOF, which normaly is -1, thus would trigger the if check here.
try2: use count of pat

---
 dlls/user32/desktop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/user32/desktop.c b/dlls/user32/desktop.c
index d22e732..da32eee 100644
--- a/dlls/user32/desktop.c
+++ b/dlls/user32/desktop.c
@@ -216,7 +216,7 @@ BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern )
         WideCharToMultiByte( CP_ACP, 0, pattern, -1, buffer, sizeof(buffer), NULL, NULL );
         if (sscanf( buffer, " %d %d %d %d %d %d %d %d",
                     &pat[0], &pat[1], &pat[2], &pat[3],
-                    &pat[4], &pat[5], &pat[6], &pat[7] ))
+                    &pat[4], &pat[5], &pat[6], &pat[7] ) == sizeof(pat)/sizeof(pat[0]))
         {
             WORD ptrn[8];
             HBITMAP hbitmap;
-- 
1.8.1.2




More information about the wine-patches mailing list