diff options
author | Valentin Bartenev <vbart@nginx.com> | 2017-08-08 22:20:01 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2017-08-08 22:20:01 +0300 |
commit | 70d73d633bc92fca9fe311fdb1ba7af1b2599c9e (patch) | |
tree | 8a543702fd715bed24e4a9fd500f2e9f3f01a253 | |
parent | 617da0d023d12e71d1c5ccb56072bcffb16a3e5e (diff) | |
download | unit-70d73d633bc92fca9fe311fdb1ba7af1b2599c9e.tar.gz unit-70d73d633bc92fca9fe311fdb1ba7af1b2599c9e.tar.bz2 |
Fixed JSON escape sequence parsing.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_conf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nxt_conf.c b/src/nxt_conf.c index 15b6a615..bad9165b 100644 --- a/src/nxt_conf.c +++ b/src/nxt_conf.c @@ -1273,7 +1273,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start, case sw_encoded4: if (nxt_fast_path((ch >= '0' && ch <= '9') - || (ch >= 'A' && ch <= 'F'))) + || (ch >= 'A' && ch <= 'F') + || (ch >= 'a' && ch <= 'f'))) { state = (state == sw_encoded4) ? sw_usual : state + 1; continue; @@ -1368,7 +1369,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start, for ( ;; ) { for (i = 0; i < 4; i++) { - utf = (utf << 4) + (p[i] - (p[i] >= 'A' ? 'A' : '0')); + utf = (utf << 4) | (p[i] >= 'A' ? 10 + ((p[i] & ~0x20) - 'A') + : p[i] - '0'); } p += 4; |