From 5c6c7e14131c7f0302b28053e6a77960acb679bd Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 9 Jun 2025 10:58:45 +0200 Subject: db: Discard unsupported ansi sequences Similarly to 360d54234f76 ("kd: Discard unsupported ansi sequences"), we should discard unsupported ansi sequences in db input, notably the bracketed paste sequences. --- ddb/db_input.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ddb/db_input.c b/ddb/db_input.c index 357474b7..04d67510 100644 --- a/ddb/db_input.c +++ b/ddb/db_input.c @@ -343,6 +343,17 @@ db_inputchar(int c) default: plain: + if (was_csi) { + if (c == '?' || c == '<' || (c >= '0' && c <= '9') || c == ';') { + /* Still in CSI */ + csi = 1; + break; + } + if (c >= '@' && c <= '~') + /* Unsupported sequence, silently drop */ + break; + /* Odd sequence, print it */ + } if (db_le == db_lbuf_end) { cnputc('\007'); } -- cgit v1.2.3