[PATCH 3/3] winex11: Prefer sprintf to snprintf in remove_startup_notification.
Alex Henrie
alexhenrie24 at gmail.com
Tue Jan 19 00:52:12 CST 2016
There is no danger of overflowing a 1024-byte buffer by writing a
12-byte string into it, so we do not need to use a string function that
spends extra cycles checking for overflow. Furthermore, writing the
quotation mark in a separate operation only clutters the code.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/winex11.drv/window.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 5c7947e..a58346f 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -126,8 +126,7 @@ static void remove_startup_notification(Display *display, Window window)
if ((src = strstr( id, "_TIME" ))) update_user_time( atol( src + 5 ));
- pos = snprintf(message, sizeof(message), "remove: ID=");
- message[pos++] = '"';
+ pos = sprintf(message, "remove: ID=\"");
for (i = 0; id[i] && pos < sizeof(message) - 3; i++)
{
if (id[i] == '"' || id[i] == '\\')
--
2.7.0
More information about the wine-patches
mailing list