Skip to content
Snippets Groups Projects
Commit b8add56e authored by Tom Lane's avatar Tom Lane
Browse files

Fix array subscript overruns identified by Yichen Xie.

parent 2e46b762
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* 1999/1/15 Tatsuo Ishii * 1999/1/15 Tatsuo Ishii
* *
* $Id: big5.c,v 1.2 2002/09/04 20:31:31 momjian Exp $ * $Id: big5.c,v 1.3 2003/01/29 01:01:05 tgl Exp $
*/ */
/* can be used in either frontend or backend */ /* can be used in either frontend or backend */
...@@ -299,7 +299,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc) ...@@ -299,7 +299,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc)
{ {
/* level 1 */ /* level 1 */
for (i = 0; i < sizeof(b1c4) / sizeof(unsigned short); i++) for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++)
{ {
if (b1c4[i][0] == big5) if (b1c4[i][0] == big5)
{ {
...@@ -320,7 +320,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc) ...@@ -320,7 +320,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc)
else else
{ {
/* level 2 */ /* level 2 */
for (i = 0; i < sizeof(b2c3) / sizeof(unsigned short); i++) for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++)
{ {
if (b2c3[i][0] == big5) if (b2c3[i][0] == big5)
{ {
...@@ -359,14 +359,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc) ...@@ -359,14 +359,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc)
big5 = BinarySearchRange(cnsPlane2ToBig5Level2, 47, cns); big5 = BinarySearchRange(cnsPlane2ToBig5Level2, 47, cns);
break; break;
case LC_CNS11643_3: case LC_CNS11643_3:
for (i = 0; i < sizeof(b2c3) / sizeof(unsigned short); i++) for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++)
{ {
if (b2c3[i][1] == cns) if (b2c3[i][1] == cns)
return (b2c3[i][0]); return (b2c3[i][0]);
} }
break; break;
case LC_CNS11643_4: case LC_CNS11643_4:
for (i = 0; i < sizeof(b1c4) / sizeof(unsigned short); i++) for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++)
{ {
if (b1c4[i][1] == cns) if (b1c4[i][1] == cns)
return (b1c4[i][0]); return (b1c4[i][0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment