Skip to content

Commit 8c70773

Browse files
committed
MDEV-35224 ASAN error in mariadb client with \c
Mariadb monitor when a line is cancelled, provided its more than one line, passes that text to the add_history of libedit. This string that has been passed however isn't null terminated resulting in an ASAN error within the libedit code. fix_history where the add_history is called is called by the com_clear, associated with the \c command, and com_go. An using the c_ptr adds a null character onto the end of the string.
1 parent f2ef683 commit 8c70773

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/mysql.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,9 @@ static void fix_history(String *final_command)
28762876
ptr++;
28772877
}
28782878
if (total_lines > 1)
2879-
add_history(fixed_buffer.ptr());
2879+
{
2880+
add_history(fixed_buffer.c_ptr());
2881+
}
28802882
}
28812883

28822884
/*

0 commit comments

Comments
 (0)