浏览代码

core: kamailio mode config parser fix

- fixed bug in parsing pvars without (), when in #!KAMAILIO mode

Reported-by: Daniel-Constantin Mierla <[email protected]>
Andrei Pelinescu-Onciul 16 年之前
父节点
当前提交
796ee85ed4
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      cfg.lex

+ 8 - 2
cfg.lex

@@ -962,10 +962,16 @@ EAT_ABLE	[\ \t\b\r]
 <PVAR_P>{LPAREN}			{ p_nest++; yymore(); }
 <PVAR_P>{LPAREN}			{ p_nest++; yymore(); }
 <PVAR_P>.					{ yymore(); }
 <PVAR_P>.					{ yymore(); }
 
 
-<PVARID>{ID}|'.'			{yymore(); }
+<PVARID>{ID}|'\.'			{yymore(); }
 <PVARID>{LPAREN}			{	state = PVAR_P_S; BEGIN(PVAR_P);
 <PVARID>{LPAREN}			{	state = PVAR_P_S; BEGIN(PVAR_P);
 								p_nest=1; yymore(); }
 								p_nest=1; yymore(); }
-<PVARID>.					{ yyless(0); state=INITIAL_S; BEGIN(INITIAL);
+<PVARID>.					{	yyless(yyleng-1);
+								count();
+								addstr(&s_buf, yytext, yyleng);
+								yylval.strval=s_buf.s;
+								memset(&s_buf, 0, sizeof(s_buf));
+								state=INITIAL_S;
+								BEGIN(INITIAL);
 								return PVAR;
 								return PVAR;
 							}
 							}