1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

windows/unicode.c: tighten up a bounds check.

Coverity points out that if we refer to cp_list[codepage - 65536], we
ought to have ensured that codepage - 65536 was _less_ than
lenof(cp_list), not just less or equal.
This commit is contained in:
Simon Tatham 2022-09-07 14:18:21 +01:00
parent 1f6d93f0c8
commit 3442fb1aeb

View File

@ -531,7 +531,7 @@ static reverse_mapping *get_reverse_mapping(int codepage)
if (codepage < 65536)
return NULL;
if (codepage > 65536 + lenof(cp_list))
if (codepage >= 65536 + lenof(cp_list))
return NULL;
const struct cp_list_item *cp = &cp_list[codepage - 65536];
if (!cp->cp_table)