]> granicus.if.org Git - postgresql/commitdiff
Prevent recursion during parse of email-like string with multiple '@'.
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 10 Mar 2009 17:33:53 +0000 (17:33 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 10 Mar 2009 17:33:53 +0000 (17:33 +0000)
Patch by Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>

src/backend/tsearch/wparser_def.c

index 61e367b650cebac902ffb7b560372f396cd690d8..dab9f27939af4683eb1163a84272e025f94cfaab 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.14.2.4 2009/03/02 15:11:25 teodor Exp $
+ *       $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.14.2.5 2009/03/10 17:33:53 teodor Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -620,6 +620,8 @@ p_ishost(TParser *prs)
        TParser    *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
        int                     res = 0;
 
+       tmpprs->wanthost = true;
+
        if (TParserGet(tmpprs) && tmpprs->type == HOST)
        {
                prs->state->posbyte += tmpprs->lenbytetoken;
@@ -1070,6 +1072,7 @@ static const TParserStateActionItem actionTPS_InHost[] = {
 };
 
 static const TParserStateActionItem actionTPS_InEmail[] = {
+       {p_isstophost, 0, A_POP, TPS_Null, 0, NULL},
        {p_ishost, 0, A_BINGO | A_CLRALL, TPS_Base, EMAIL, NULL},
        {NULL, 0, A_POP, TPS_Null, 0, NULL}
 };