mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Add some missing casts in ctype functions.
I thought I'd found all of these before, but perhaps a few managed to slip in since I last looked. The character argument to the <ctype.h> functions must have the value of an unsigned char or EOF; passing an ordinary char (unless you know char is unsigned on every platform the code will ever go near) risks mistaking '\xFF' for EOF, and causing outright undefined behaviour on byte values in the range 80-FE. Never do it.
This commit is contained in:
@ -63,7 +63,7 @@ bool validate_manual_hostkey(char *key)
|
||||
if (r[3*i+2] != ':')
|
||||
goto not_fingerprint; /* sorry */
|
||||
for (i = 0; i < 16*3 - 1; i++)
|
||||
key[i] = tolower(r[i]);
|
||||
key[i] = tolower((unsigned char)r[i]);
|
||||
key[16*3 - 1] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user