summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-06-09 10:58:45 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-06-09 10:58:45 +0200
commit5c6c7e14131c7f0302b28053e6a77960acb679bd (patch)
tree7f683a2d8b7e9c21f94a1cd0191bb124e893d7ab
parent221e75b9ba1149c4a3057a32d5e8fcc07ffa5d61 (diff)
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.
-rw-r--r--ddb/db_input.c11
1 files changed, 11 insertions, 0 deletions
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');
}