summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-04-12 14:10:08 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2022-04-25 17:51:59 +0100
commitc5a891a29d1d4f946181f6699bcf7f6fe35b43e6 (patch)
treeecaaae46a3a81e9d183e06cd8b353d9f2ebf1dd3
parent09ad15b9869c4a6f715167ae3caa7210a1f906ce (diff)
downloadzsh-c5a891a29d1d4f946181f6699bcf7f6fe35b43e6.tar.gz
zsh-c5a891a29d1d4f946181f6699bcf7f6fe35b43e6.tar.xz
zsh-c5a891a29d1d4f946181f6699bcf7f6fe35b43e6.zip
50049: care with signed characters
Some signed-to-unsigned casts needed for a couple of cases of pointers
used as indices.
-rw-r--r--ChangeLog6
-rw-r--r--Src/exec.c2
-rw-r--r--Src/prompt.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 80a7f4657..434db5ab9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-04-12  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 50049: Src/exec.c, Src/prompt.c: care with signed character
+	indices on the few remaining systems such as Cygwin that aren't
+	otherwise protected.
+
 2022-04-20  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* 50081: Src/pattern.c, Src/params.c: reset global mbstate_t
diff --git a/Src/exec.c b/Src/exec.c
index 27d49e005..47753da48 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -561,7 +561,7 @@ zexecve(char *pth, char **argv, char **newenvp)
                         isbinary = 1;
                         hasletter = 0;
                         for (ptr = execvebuf; ptr < ptr2; ptr++) {
-                            if (islower(*ptr) || *ptr == '$' || *ptr == '`')
+                            if (islower(STOUC(*ptr)) || *ptr == '$' || *ptr == '`')
                                 hasletter = 1;
                             if (hasletter && *ptr == '\n') {
                                 isbinary = 0;
diff --git a/Src/prompt.c b/Src/prompt.c
index 738c7fc7a..092de63a4 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1666,7 +1666,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
 	tc = TCBGCOLOUR;
     }
     if (teststrp) {
-	if (**teststrp == '#' && isxdigit((*teststrp)[1])) {
+	if (**teststrp == '#' && isxdigit(STOUC((*teststrp)[1]))) {
 	    struct color_rgb color;
 	    char *end;
 	    zlong col = zstrtol(*teststrp+1, &end, 16);