Module: kamailio
Branch: master
Commit: 38b4bbd8b90859b7f90187103f5e7faf04ccd8bd
URL:
https://github.com/kamailio/kamailio/commit/38b4bbd8b90859b7f90187103f5e7fa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-09-07T12:10:57+02:00
core: try to catch dash immediately after ID in define/ifdef
- reported by GH #743
---
Modified: cfg.lex
---
Diff:
https://github.com/kamailio/kamailio/commit/38b4bbd8b90859b7f90187103f5e7fa…
Patch:
https://github.com/kamailio/kamailio/commit/38b4bbd8b90859b7f90187103f5e7fa…
---
diff --git a/cfg.lex b/cfg.lex
index 731d00e..2361687 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -1192,9 +1192,9 @@ IMPORTFILE "import_file"
<INITIAL>{COM_LINE}!{SER_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_SER;}
-<INITIAL>{COM_LINE}!{KAMAILIO_CFG}{CR} { count();
+<INITIAL>{COM_LINE}!{KAMAILIO_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_KAMAILIO;}
-<INITIAL>{COM_LINE}!{MAXCOMPAT_CFG}{CR} { count();
+<INITIAL>{COM_LINE}!{MAXCOMPAT_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_MAX;}
<INITIAL>{PREP_START}{DEFINE}{EAT_ABLE}+ { count(); pp_define_set_type(0);
@@ -1203,6 +1203,12 @@ IMPORTFILE "import_file"
state = DEFINE_S; BEGIN(DEFINE_ID); }
<INITIAL>{PREP_START}{REDEF}{EAT_ABLE}+ { count(); pp_define_set_type(2);
state = DEFINE_S; BEGIN(DEFINE_ID); }
+<DEFINE_ID>{ID}{MINUS} { count();
+ LOG(L_CRIT,
+ "error at %s line %d: '-' not allowed\n",
+ (finame)?finame:"cfg", line);
+ exit(-1);
+ }
<DEFINE_ID>{ID} { count();
if (pp_define(yyleng, yytext)) return 1;
state = DEFINE_EOL_S; BEGIN(DEFINE_EOL); }
@@ -1230,6 +1236,12 @@ IMPORTFILE "import_file"
<INITIAL,IFDEF_SKIP>{PREP_START}{IFNDEF}{EAT_ABLE}+ { count();
if (pp_ifdef_type(0)) return 1;
state = IFDEF_S; BEGIN(IFDEF_ID); }
+<IFDEF_ID>{ID}{MINUS} { count();
+ LOG(L_CRIT,
+ "error at %s line %d: '-' not allowed\n",
+ (finame)?finame:"cfg", line);
+ exit(-1);
+ }
<IFDEF_ID>{ID} { count();
pp_ifdef_var(yyleng, yytext);
state = IFDEF_EOL_S; BEGIN(IFDEF_EOL); }