Fork 0

prom.awk: Correct regex escape

I'm not confident this ever worked as intended.  Unless behavior in
newer Gawks changed (since now it is issuing a warning where it wasn't

This replaced double quotes with '0'..which certainly solves the
security problem of double quotes, but not in the intended way.  I have
no labels with double quotes and so never noticed.

I suspect that I tried using // delimiters to avoid having to go through
this escape mess ("\\\\" to produce "\\" which is recogniezd as a single
"\" in the replacement, and then a fifth to escape the double quote.
What a mess.
Mike Gerwitz 2023-12-31 16:04:20 -05:00
parent 16108f0c2e
commit d511fa8d17
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 1 additions and 1 deletions

View File

@ -109,7 +109,7 @@ function _prom_assert_valid_label(name) {
# Escape double quotes in label value VALUE and return the result.
function _prom_label_escape(value) {
return gensub(/"/, /\"/, "g", value)
return gensub(/"/, "\\\\\"", "g", value)