about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-12-13 20:12:06 +0900
committerOliver Kiddle <opk@zsh.org>2022-12-17 00:35:36 +0100
commit2701ab161df1f259b8292a650a4ea5cebd668d81 (patch)
tree1743525971d285a2fda9754e1c1c83949cc03804 /Src/builtin.c
parenta73c705b0c864a9ce042fca6e72e0c92d4ad8237 (diff)
downloadzsh-2701ab161df1f259b8292a650a4ea5cebd668d81.tar.gz
zsh-2701ab161df1f259b8292a650a4ea5cebd668d81.tar.xz
zsh-2701ab161df1f259b8292a650a4ea5cebd668d81.zip
51207: fix for read -d when the delimiter is a byte >= 0x80
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index db83313d6..951970138 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -6286,7 +6286,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
     char *laststart;
     size_t ret;
 #else
-    char delim = '\n';
+    int delim = '\n';
 #endif
 
     if (OPT_HASARG(ops,c='k')) {
@@ -6413,10 +6413,11 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
 	if (wi != WEOF)
 	    delim = (wchar_t)wi;
 	else
-	    delim = (wchar_t)((delimstr[0] == Meta) ?
+	    delim = (wchar_t) (unsigned char) ((delimstr[0] == Meta) ?
 			      delimstr[1] ^ 32 : delimstr[0]);
 #else
-        delim = (delimstr[0] == Meta) ? delimstr[1] ^ 32 : delimstr[0];
+        delim = (unsigned char) ((delimstr[0] == Meta) ?
+			delimstr[1] ^ 32 : delimstr[0]);
 #endif
 	if (SHTTY != -1) {
 	    struct ttyinfo ti;