Prevent recursion during parse of email-like string with multiple '@'.
authorTeodor Sigaev <[email protected]>
Tue, 10 Mar 2009 17:44:44 +0000 (17:44 +0000)
committerTeodor Sigaev <[email protected]>
Tue, 10 Mar 2009 17:44:44 +0000 (17:44 +0000)
Patch by Heikki Linnakangas <[email protected]>

contrib/tsearch2/wordparser/parser.c

index 9d0a3704857e98e5480a89f9b7c8676c9a4d3dfc..2a65cc5bc5b0b01767a56b0d90c9debb180eb053 100644 (file)
@@ -370,6 +370,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->lenbytelexeme;
@@ -801,6 +803,7 @@ static TParserStateActionItem actionTPS_InHost[] = {
 };
 
 static 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}
 };