izj/izzj: Fix escaping of special chars (#4392)

This commit is contained in:
Khairul Azhar Kasmiran 2024-03-26 22:52:06 +08:00 committed by GitHub
parent 576d4b8a5e
commit 508bbae8a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 4 deletions

View file

@ -2728,7 +2728,7 @@ static bool strings_print(RzCore *core, RzCmdStateOutput *state, const RzPVector
RzStrEscOptions opt = { 0 };
opt.show_asciidot = false;
opt.esc_bslash = true;
opt.esc_double_quotes = state->mode == RZ_OUTPUT_MODE_JSON || state->mode == RZ_OUTPUT_MODE_LONG_JSON;
opt.esc_double_quotes = false;
char *escaped_string = rz_str_escape_utf8_keep_printable(string->string, &opt);
switch (state->mode) {
@ -2742,8 +2742,10 @@ static bool strings_print(RzCore *core, RzCmdStateOutput *state, const RzPVector
pj_kn(state->d.pj, "length", string->length);
pj_ks(state->d.pj, "section", section_name);
pj_ks(state->d.pj, "type", type_string);
// data itself may be encoded so use pj_ks
pj_ks(state->d.pj, "string", escaped_string);
// data itself may be encoded so use pj_ks.
// string->string is used instead of escaped_string
// because it's pj_ks that does the escaping.
pj_ks(state->d.pj, "string", string->string);
switch (string->type) {
case RZ_STRING_ENC_UTF8:

File diff suppressed because one or more lines are too long