summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-03-28 15:27:51 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2022-03-28 15:27:51 +0100
commit1e814ba48bd92fcf573b4c58eca109ed93508651 (patch)
tree2d9990dff5679228b0a79c1950e985ef3860d9fc
parent57305cf245853b8b30895b41a90142dffab97e38 (diff)
downloadzsh-1e814ba48bd92fcf573b4c58eca109ed93508651.tar.gz
zsh-1e814ba48bd92fcf573b4c58eca109ed93508651.zip
49890: Avoid scanning unallocated memory in saved command line.
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_utils.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 21d68de57..7603b7cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-28 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49890: Src/Zle/zle_utils.c: best not to look at unallocated
+ memory in saved command line.
+
2022-03-24 Peter Stephenson <p.stephenson@samsung.com>
* 49875: Completion/Unix/Command/_texinfo: info -f completes
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index c85f8450d..526216fa7 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1530,7 +1530,7 @@ mkundoent(void)
struct change *ch;
UNMETACHECK();
- if(lastll == zlell && !ZS_memcmp(lastline, zleline, zlell)) {
+ if(lastll == zlell && lastlinesz >= zlell && !ZS_memcmp(lastline, zleline, zlell)) {
lastcs = zlecs;
return;
}