Fix out of bounds array accesses for Cyrillic2 found by cppcheck.

This commit is contained in:
Michael Drake 2014-04-02 21:00:48 +01:00
parent 3445483e78
commit 442d1cb3cf
1 changed files with 2 additions and 2 deletions

View File

@ -481,7 +481,7 @@ nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
/* get encoding name */
enc = (alphabet <= CONT_ENC_END ? localencodings[alphabet - 100]
: (alphabet == 120 ?
localencodings[CONT_ENC_END + 1]
localencodings[CONT_ENC_END - 100 + 1]
: localencodings[0]));
/* create output buffer */
@ -591,7 +591,7 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
/* get encoding name */
enc = (alphabet <= CONT_ENC_END ? localencodings[alphabet - 100]
: (alphabet == 120 ?
localencodings[CONT_ENC_END + 1]
localencodings[CONT_ENC_END - 100 + 1]
: localencodings[0]));
/* create output buffer (oversized) */