Skip to content

Commit b8add56

Browse files
committed
Fix array subscript overruns identified by Yichen Xie.
1 parent 2e46b76 commit b8add56

File tree

1 file changed

+5
-5
lines changed
  • src/backend/utils/mb/conversion_procs/euc_tw_and_big5

1 file changed

+5
-5
lines changed

src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* 1999/1/15 Tatsuo Ishii
99
*
10-
* $Id: big5.c,v 1.2 2002/09/04 20:31:31 momjian Exp $
10+
* $Id: big5.c,v 1.3 2003/01/29 01:01:05 tgl Exp $
1111
*/
1212

1313
/* can be used in either frontend or backend */
@@ -299,7 +299,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc)
299299
{
300300
/* level 1 */
301301

302-
for (i = 0; i < sizeof(b1c4) / sizeof(unsigned short); i++)
302+
for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++)
303303
{
304304
if (b1c4[i][0] == big5)
305305
{
@@ -320,7 +320,7 @@ BIG5toCNS(unsigned short big5, unsigned char *lc)
320320
else
321321
{
322322
/* level 2 */
323-
for (i = 0; i < sizeof(b2c3) / sizeof(unsigned short); i++)
323+
for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++)
324324
{
325325
if (b2c3[i][0] == big5)
326326
{
@@ -359,14 +359,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc)
359359
big5 = BinarySearchRange(cnsPlane2ToBig5Level2, 47, cns);
360360
break;
361361
case LC_CNS11643_3:
362-
for (i = 0; i < sizeof(b2c3) / sizeof(unsigned short); i++)
362+
for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++)
363363
{
364364
if (b2c3[i][1] == cns)
365365
return (b2c3[i][0]);
366366
}
367367
break;
368368
case LC_CNS11643_4:
369-
for (i = 0; i < sizeof(b1c4) / sizeof(unsigned short); i++)
369+
for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++)
370370
{
371371
if (b1c4[i][1] == cns)
372372
return (b1c4[i][0]);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy