pd: Don't abort string printing on initial null if bin.str.enc != guess (#15446) ##bin

This commit is contained in:
Khairul Azhar Kasmiran 2019-11-12 00:59:07 +08:00 committed by radare
parent 93c7a54e9a
commit 8ab6a6ff93

View File

@ -3997,10 +3997,12 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
}
}
}
bool print_msg = true;
#if 1
if (!(IS_PRINTABLE (*msg) || IS_WHITECHAR (*msg)
if (ds->strenc == R_STRING_ENC_GUESS &&
!(IS_PRINTABLE (*msg) || IS_WHITECHAR (*msg)
|| (len > 1 && !memcmp (msg, "\xff\xfe", 2)))) {
*msg = 0;
print_msg = false;
} else {
msg[len - 1] = 0;
}
@ -4012,12 +4014,12 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
if (msg2) {
r_str_filter (msg2, 0);
if (!strncmp (msg2, "UH..", 4)) {
*msg = 0;
print_msg = false;
}
free (msg2);
}
}
if (*msg) {
if (print_msg) {
if (!string_printed) {
ds_print_str (ds, msg, len, refaddr);
string_printed = true;
@ -4051,7 +4053,7 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
}
} else {
if (r_core_anal_address (core, refaddr) & R_ANAL_ADDR_TYPE_ASCII) {
if (!string_printed && *msg) {
if (!string_printed && print_msg) {
ds_print_str (ds, msg, len, refaddr);
string_printed = true;
}
@ -4062,7 +4064,7 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
kind = r_anal_data_kind (core->anal, refaddr, (const ut8*)msg, len - 1);
if (kind) {
if (!strcmp (kind, "text")) {
if (!string_printed && *msg) {
if (!string_printed && print_msg) {
ds_print_str (ds, msg, len, refaddr);
string_printed = true;
}