[PATCH 1/3] winex11: Fix overflow in remove_startup_notification.

Alex Henrie alexhenrie24 at gmail.com
Tue Jan 19 00:52:10 CST 2016


Coverity #713245, "Checking pos < 1022U implies that pos is between
1022 and 1023 (inclusive) on the false branch."

This patch does the bare minimum to fix the problem.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/winex11.drv/window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 836e62c..4a047e2 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -128,7 +128,7 @@ static void remove_startup_notification(Display *display, Window window)
 
     pos = snprintf(message, sizeof(message), "remove: ID=");
     message[pos++] = '"';
-    for (i = 0; id[i] && pos < sizeof(message) - 2; i++)
+    for (i = 0; id[i] && pos < sizeof(message) - 3; i++)
     {
         if (id[i] == '"' || id[i] == '\\')
             message[pos++] = '\\';
-- 
2.7.0




More information about the wine-patches mailing list