mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 20:12:48 -05: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:
@ -531,7 +531,7 @@ static reverse_mapping *get_reverse_mapping(int codepage)
|
|||||||
|
|
||||||
if (codepage < 65536)
|
if (codepage < 65536)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (codepage > 65536 + lenof(cp_list))
|
if (codepage >= 65536 + lenof(cp_list))
|
||||||
return NULL;
|
return NULL;
|
||||||
const struct cp_list_item *cp = &cp_list[codepage - 65536];
|
const struct cp_list_item *cp = &cp_list[codepage - 65536];
|
||||||
if (!cp->cp_table)
|
if (!cp->cp_table)
|
||||||
|
Reference in New Issue
Block a user