From: Ben Harris Date: Sun, 11 Jan 2009 14:26:27 +0000 (+0000) Subject: Arguments to ctype functions are required to be either EOF or representable X-Git-Tag: 0.61~167 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=36f502fa9311a62923cf83b34a4016ad68aaa33f;p=PuTTY.git Arguments to ctype functions are required to be either EOF or representable as unsigned char. This means that passing in a bare char is incorrect on systems where char is signed. Sprinkle some appropriate casts to prevent this. [originally from svn r8406] --- diff --git a/cmdgen.c b/cmdgen.c index 9aa585f3..ae405208 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -119,7 +119,7 @@ void sk_cleanup(void) void showversion(void) { char *verstr = dupstr(ver); - verstr[0] = tolower(verstr[0]); + verstr[0] = tolower((unsigned char)verstr[0]); printf("PuTTYgen %s\n", verstr); sfree(verstr); } diff --git a/logging.c b/logging.c index db02892a..17924c5a 100644 --- a/logging.c +++ b/logging.c @@ -384,7 +384,7 @@ static void xlatlognam(Filename *dest, Filename src, char c; s++; size = 0; - if (*s) switch (c = *s++, tolower(c)) { + if (*s) switch (c = *s++, tolower((unsigned char)c)) { case 'y': size = strftime(buf, sizeof(buf), "%Y", tm); break; diff --git a/terminal.c b/terminal.c index 19d5a750..4f0d8225 100644 --- a/terminal.c +++ b/terminal.c @@ -5942,7 +5942,7 @@ void term_key(Terminal *term, Key_Sym keysym, wchar_t *text, size_t tlen, if (modifiers & PKM_CONTROL) c &= 0x1f; else if (modifiers & PKM_SHIFT) - c = toupper(c); + c = toupper((unsigned char)c); } *p++ = c; goto done;