From c5a891a29d1d4f946181f6699bcf7f6fe35b43e6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 12 Apr 2022 14:10:08 +0100 Subject: 50049: care with signed characters Some signed-to-unsigned casts needed for a couple of cases of pointers used as indices. --- ChangeLog | 6 ++++++ Src/exec.c | 2 +- Src/prompt.c | 2 +- 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 + + * 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 * 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); -- cgit 1.4.1