summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2020-03-25 19:14:15 +0300
committerValentin Bartenev <vbart@nginx.com>2020-03-25 19:14:15 +0300
commitfd8e524b823629b700ae550faced472757df3fbb (patch)
tree65205967ae7e6571683f945c1e277c5f394e8a6e /src/nxt_conf.c
parent48ad88ee7209fd949f3ed1075f62ca78c2220224 (diff)
downloadunit-fd8e524b823629b700ae550faced472757df3fbb.tar.gz
unit-fd8e524b823629b700ae550faced472757df3fbb.tar.bz2
Configuration: fixed comments parsing.
Unclosed multi-line comments and "/" at the end of JSON shouldn't be allowed.
Diffstat (limited to 'src/nxt_conf.c')
-rw-r--r--src/nxt_conf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nxt_conf.c b/src/nxt_conf.c
index 2a952c35..3e1130be 100644
--- a/src/nxt_conf.c
+++ b/src/nxt_conf.c
@@ -1269,6 +1269,7 @@ nxt_conf_json_skip_space(u_char *start, u_char *end)
case '\r':
continue;
case '/':
+ start = p;
state = sw_after_slash;
continue;
}
@@ -1285,7 +1286,6 @@ nxt_conf_json_skip_space(u_char *start, u_char *end)
continue;
}
- p--;
break;
case sw_single_comment:
@@ -1318,6 +1318,10 @@ nxt_conf_json_skip_space(u_char *start, u_char *end)
break;
}
+ if (nxt_slow_path(state != sw_normal)) {
+ return start;
+ }
+
return p;
}