Skip to content

Commit

Permalink
Merge pull request #260 from u5surf/issue-142
Browse files Browse the repository at this point in the history
Fix escaping filter_key in prometheus output
  • Loading branch information
u5surf authored Mar 26, 2023
2 parents dd6930c + 4b4dd60 commit a98a4b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ngx_http_vhost_traffic_status_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ ngx_http_vhost_traffic_status_escape_prometheus(ngx_pool_t *pool, ngx_str_t *buf
}
} else {
char_end = pa;
if (ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
if (*pa >= 0xf8 || ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
break;
} else {
pa = char_end;
Expand Down Expand Up @@ -237,7 +237,7 @@ ngx_http_vhost_traffic_status_escape_prometheus(ngx_pool_t *pool, ngx_str_t *buf
}
} else {
char_end = pa;
if (ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
if (*pa >= 0xf8 || ngx_utf8_decode(&char_end, last - pa) > 0x10ffff) {
/* invalid UTF-8 - escape single char to allow resynchronization */
c = *pa++;
/* two slashes are required to be valid encoding for prometheus*/
Expand Down

0 comments on commit a98a4b8

Please sign in to comment.