summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2025-12-16 01:13:40 +0100
committerOliver Kiddle <opk@zsh.org>2025-12-16 01:13:40 +0100
commitaf47b221671839bc772fa3d133a565556711847c (patch)
tree30d73581b18aa2285c0592f154cb6168e6b6371e
parent54117: update apt completion (diff)
downloadzsh-af47b221671839bc772fa3d133a565556711847c.tar
zsh-af47b221671839bc772fa3d133a565556711847c.tar.gz
zsh-af47b221671839bc772fa3d133a565556711847c.tar.bz2
zsh-af47b221671839bc772fa3d133a565556711847c.tar.lz
zsh-af47b221671839bc772fa3d133a565556711847c.tar.xz
zsh-af47b221671839bc772fa3d133a565556711847c.tar.zst
zsh-af47b221671839bc772fa3d133a565556711847c.zip
54147: avoid buffer overflow with terminal sequences
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/termquery.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b4adc0235..8f6b9adbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-12-16 Oliver Kiddle <opk@zsh.org>
+
+ * 54147: Src/Zle/termquery.c: avoid buffer overflow with
+ terminal sequences
+
2025-11-30 Oliver Kiddle <opk@zsh.org>
* Christopher Bock: 54117: update apt completion
diff --git a/Src/Zle/termquery.c b/Src/Zle/termquery.c
index a2d617db8..c8f5385d9 100644
--- a/Src/Zle/termquery.c
+++ b/Src/Zle/termquery.c
@@ -703,10 +703,10 @@ collate_seq(int sindex, int dir)
}
if (enabled) {
if (i)
- strucpy(&pos, editext[i].seq[sindex]);
+ struncpy(&pos, editext[i].seq[sindex], seq + sizeof(seq) - pos - 1);
else if ((bracket = getaparam("zle_bracketed_paste")) &&
arrlen(bracket) == 2)
- strucpy(&pos, bracket[sindex]);
+ struncpy(&pos, bracket[sindex], seq + sizeof(seq) - pos - 1);
}
}
write_loop(SHTTY, seq, pos - seq);