aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2009-01-29 16:09:12 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2009-01-29 16:09:12 +0000
commit3c66f7c8d6ce245a6e3aaedd0d7fbaf1cb7ccba9 (patch)
treed5f26a883f52d32b714817b5c71cca9b536dac18
parente40c166d6ec87b71500c8034fd2ce3d1ec3d2c26 (diff)
downloadpostgresql-3c66f7c8d6ce245a6e3aaedd0d7fbaf1cb7ccba9.tar.gz
postgresql-3c66f7c8d6ce245a6e3aaedd0d7fbaf1cb7ccba9.zip
Fix incorrect dereferencing of char* to array's index.
Per Tommy Gildseth <tommy.gildseth@usit.uio.no> report
-rw-r--r--src/backend/tsearch/spell.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index f21143feb08..ac8dd429cd5 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.11.2.2 2008/06/19 16:52:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.11.2.3 2009/01/29 16:09:12 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@@ -521,7 +521,7 @@ addFlagValue(IspellDict *Conf, char *s, uint32 val)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("multibyte flag character is not allowed")));
- Conf->flagval[(unsigned int) *s] = (unsigned char) val;
+ Conf->flagval[*(unsigned char*) s] = (unsigned char) val;
Conf->usecompound = true;
}
@@ -654,7 +654,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
ptr = repl + (ptr - prepl) + 1;
while (*ptr)
{
- aflg |= Conf->flagval[(unsigned int) *ptr];
+ aflg |= Conf->flagval[*(unsigned char*) ptr];
ptr++;
}
}
@@ -735,7 +735,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
if (*s && pg_mblen(s) == 1)
{
- Conf->flagval[(unsigned int) *s] = FF_COMPOUNDFLAG;
+ Conf->flagval[*(unsigned char*) s] = FF_COMPOUNDFLAG;
Conf->usecompound = true;
}
oldformat = true;
@@ -791,7 +791,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("multibyte flag character is not allowed")));
- flag = (unsigned char) *s;
+ flag = *(unsigned char*) s;
goto nextline;
}
if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 ||
@@ -851,7 +851,7 @@ makeCompoundFlags(IspellDict *Conf, int affix)
while (str && *str)
{
- flag |= Conf->flagval[(unsigned int) *str];
+ flag |= Conf->flagval[*(unsigned char*) str];
str++;
}