summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2019-03-19 13:44:47 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2019-03-19 13:44:47 +0000
commit73b29f079b50412700727e0f77991506c03d19fe (patch)
tree786d08db085967f0f7d780aa96d493cf92ae0b80 /Src/hist.c
parent6331772c5b35ff9d4deb80ff9461d04b5e0d2db5 (diff)
downloadzsh-73b29f079b50412700727e0f77991506c03d19fe.tar.gz
zsh-73b29f079b50412700727e0f77991506c03d19fe.tar.xz
zsh-73b29f079b50412700727e0f77991506c03d19fe.zip
44142: Fix hist_reduce_spaces bug.
When there were as an unstripped comment on the line the
pointer for stripping spaces could be bogus.  Don't do
any editing in that case.
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c
index f7e53de74..901cd3b1a 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1198,8 +1198,9 @@ histreduceblanks(void)
 	chline[pos] = '\0';
     } else {
 	ptr = chline + pos;
-	while ((*ptr++ = *lastptr++))
-	    ;
+	if (ptr < lastptr)
+	    while ((*ptr++ = *lastptr++))
+		;
     }
 }