Commit 42831729 authored by Teodor Sigaev's avatar Teodor Sigaev

Prevent recursion during parse of email-like string with multiple '@'.

Patch by Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
parent b0c68c24
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.21 2009/03/02 15:10:09 teodor Exp $ * $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.22 2009/03/10 17:32:14 teodor Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -620,6 +620,8 @@ p_ishost(TParser *prs) ...@@ -620,6 +620,8 @@ p_ishost(TParser *prs)
TParser *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte); TParser *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
int res = 0; int res = 0;
tmpprs->wanthost = true;
if (TParserGet(tmpprs) && tmpprs->type == HOST) if (TParserGet(tmpprs) && tmpprs->type == HOST)
{ {
prs->state->posbyte += tmpprs->lenbytetoken; prs->state->posbyte += tmpprs->lenbytetoken;
...@@ -1070,6 +1072,7 @@ static const TParserStateActionItem actionTPS_InHost[] = { ...@@ -1070,6 +1072,7 @@ static const TParserStateActionItem actionTPS_InHost[] = {
}; };
static const TParserStateActionItem actionTPS_InEmail[] = { 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}, {p_ishost, 0, A_BINGO | A_CLRALL, TPS_Base, EMAIL, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL} {NULL, 0, A_POP, TPS_Null, 0, NULL}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment