summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-08 15:36:31 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-08 15:36:31 +0900
commitcd1a0a70972e717aa93c5fd6b36f476b5593c206 (patch)
tree06a1b6c39ede5c9b422aa942e6d75a09856e9662
parent2778fc5d7a1bf974147ee7e9b116adac97e20eea (diff)
downloadzsh-cd1a0a70972e717aa93c5fd6b36f476b5593c206.tar.gz
zsh-cd1a0a70972e717aa93c5fd6b36f476b5593c206.zip
51826: correctly read metafied null character from history file
-rw-r--r--ChangeLog3
-rw-r--r--Src/hist.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 16ce32b54..ca290ea2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2023-06-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+ * 51826: Src/hist.c: correctly handle metafied null character
+ when reading history file
+
* Stephane: 51817: Completion/BSD/Command/_rcctl: protect ':'
in _rcctl (was in 51817 but missed in commit 0577daf)
diff --git a/Src/hist.c b/Src/hist.c
index b4dc53d90..bfbcd6ede 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -3803,8 +3803,14 @@ histsplitwords(char *lineptr, short **wordsp, int *nwordsp, int *nwordposp,
zrealloc(words, nwords*sizeof(*words));
}
words[nwordpos++] = lineptr - start;
- while (*lineptr && !inblank(*lineptr))
- lineptr++;
+ while (*lineptr) {
+ if (*lineptr == Meta && lineptr[1])
+ lineptr += 2;
+ else if (!inblank(*lineptr))
+ lineptr++;
+ else
+ break;
+ }
words[nwordpos++] = lineptr - start;
}
} while (*lineptr);