mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -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:
parent
1f6d93f0c8
commit
3442fb1aeb
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user