From: Sebastian Lackner Subject: server: Fix detection of duplicate console history lines. (v2) Message-Id: <6e73c83c-8a45-bc30-4ff1-82b03232d071@fds-team.de> Date: Thu, 28 Apr 2016 13:57:29 +0200 Signed-off-by: Sebastian Lackner --- 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