Skip to content

Commit a98a4b8

Browse files
authored
Merge pull request #260 from u5surf/issue-142
Fix escaping filter_key in prometheus output
2 parents dd6930c + 4b4dd60 commit a98a4b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ngx_http_vhost_traffic_status_string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ ngx_http_vhost_traffic_status_escape_prometheus(ngx_pool_t *pool, ngx_str_t *buf
187187
}
188188
} else {
189189
char_end = pa;
190-
if (ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
190+
if (*pa >= 0xf8 || ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
191191
break;
192192
} else {
193193
pa = char_end;
@@ -237,7 +237,7 @@ ngx_http_vhost_traffic_status_escape_prometheus(ngx_pool_t *pool, ngx_str_t *buf
237237
}
238238
} else {
239239
char_end = pa;
240-
if (ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
240+
if (*pa >= 0xf8 || ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
241241
/* invalid UTF-8 - escape single char to allow resynchronization */
242242
c = *pa++;
243243
/* two slashes are required to be valid encoding for prometheus*/

0 commit comments

Comments
 (0)