Fix travis-asan issue in cmd_pd with highlight

This commit is contained in:
pancake 2018-07-17 20:24:17 +02:00
parent 9ddce7af9c
commit a13e35371e
2 changed files with 3 additions and 3 deletions

View File

@ -890,7 +890,7 @@ static void ds_highlight_word(RDisasmState * ds, char *word, char *color) {
char *source = ds->opstr? ds->opstr: ds->asmop.buf_asm;
const char *color_reset = line_highlighted (ds) ? ds->color_linehl : Color_RESET_BG;
char *asm_str = r_str_highlight (source, word, color, color_reset);
ds->opstr = asm_str? asm_str:source;
ds->opstr = asm_str? asm_str: source;
}
static void ds_build_op_str(RDisasmState *ds, bool print_color) {

View File

@ -2861,7 +2861,7 @@ static int strncmp_skip_color_codes(const char *s1, const char *s2, int n) {
static char *strchr_skip_color_codes(const char *s, int c) {
int i = 0;
for (i = 0; s[i]; i++) {
while (s[i] == 0x1b) {
while (s[i] && s[i] == 0x1b) {
while (s[i] && s[i] != 'm') {
i++;
}
@ -2869,7 +2869,7 @@ static char *strchr_skip_color_codes(const char *s, int c) {
i++;
}
}
if (s[i] == (char)c) {
if (!s[i] || s[i] == (char)c) {
return (char*)s + i;
}
}