aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-12-29 00:39:01 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-12-29 00:39:01 +0100
commite727bdcde63804a308103adeaa2637c5ee1ebdc8 (patch)
treedd4f7d84028f8ad822bea0697329c700d769dca0 /src
parent8d96c02e5118cf7bd656fde9100570a67115d19a (diff)
downloadblogc-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.c19
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: