server: Fix detection of duplicate console history lines. (v2)

Sebastian Lackner sebastian at fds-team.de
Thu Apr 28 06:57:29 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
Changes in v2:
* We can't really use memcmp because it could allow exploits with special input,
  like "abc\0def", where it would probably compare past the end of the string.

 server/console.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/console.c b/server/console.c
index efb20da..4d275f0 100644
--- a/server/console.c
+++ b/server/console.c
@@ -1055,7 +1055,7 @@ static void console_input_append_hist( struct console_input* console, const WCHA
     ptr[len] = 0;
 
     if (console->history_mode && console->history_index &&
-	strncmpW( console->history[console->history_index - 1], ptr, len ) == 0)
+        !strcmpW( console->history[console->history_index - 1], ptr ))
     {
 	/* ok, mode ask us to not use twice the same string...
 	 * so just free mem and returns
-- 
2.8.0



More information about the wine-patches mailing list