diff options
| author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-12-29 00:39:01 +0100 | 
|---|---|---|
| committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-12-29 00:39:01 +0100 | 
| commit | e727bdcde63804a308103adeaa2637c5ee1ebdc8 (patch) | |
| tree | dd4f7d84028f8ad822bea0697329c700d769dca0 /src | |
| parent | 8d96c02e5118cf7bd656fde9100570a67115d19a (diff) | |
| download | blogc-e727bdcde63804a308103adeaa2637c5ee1ebdc8.tar.gz blogc-e727bdcde63804a308103adeaa2637c5ee1ebdc8.tar.bz2 blogc-e727bdcde63804a308103adeaa2637c5ee1ebdc8.zip  | |
template-parser: do not accept variables startins with numbers and _
Diffstat (limited to 'src')
| -rw-r--r-- | src/template-parser.c | 19 | 
1 files changed, 10 insertions, 9 deletions
diff --git a/src/template-parser.c b/src/template-parser.c index e5c750e..030ecca 100644 --- a/src/template-parser.c +++ b/src/template-parser.c @@ -338,21 +338,22 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)              case TEMPLATE_BLOCK_IF_OPERAND_START:                  if (c == ' ')                      break; -                if ((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_') { +                if (c >= 'A' && c <= 'Z') {                      state = TEMPLATE_BLOCK_IF_VARIABLE_OPERAND;                      start2 = current;                      break;                  } -                if (c != '"') { -                    op_start = 0; -                    op_end = 0; -                    *err = blogc_error_parser(BLOGC_ERROR_TEMPLATE_PARSER, src, -                        src_len, current, -                        "Invalid 'if' operand. Must be double-quoted static string."); +                if (c == '"') { +                    state = TEMPLATE_BLOCK_IF_STRING_OPERAND; +                    start2 = current;                      break;                  } -                state = TEMPLATE_BLOCK_IF_STRING_OPERAND; -                start2 = current; +                op_start = 0; +                op_end = 0; +                *err = blogc_error_parser(BLOGC_ERROR_TEMPLATE_PARSER, src, +                    src_len, current, +                    "Invalid 'if' operand. Must be double-quoted static " +                    "string or variable.");                  break;              case TEMPLATE_BLOCK_IF_STRING_OPERAND:  | 
