Skip to content

Commit

Permalink
Merge pull request #948 from riscv/uninitialized_dump
Browse files Browse the repository at this point in the history
target/riscv: Prevent dump_field() reading uninitialized memory
  • Loading branch information
timsifive authored Oct 31, 2023
2 parents c92149a + e474d1d commit 51679e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/target/riscv/riscv-013.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,20 @@ static unsigned int decode_dm(char *text, unsigned int address, unsigned int dat
context, data);
}
}
if (text)
text[0] = '\0';
return 0;
}

static unsigned int decode_dmi(struct target *target, char *text, unsigned int address,
unsigned int data)
{
dm013_info_t *dm = get_dm(target);
if (!dm)
if (!dm) {
if (text)
text[0] = '\0';
return 0;
}
return decode_dm(text, address - dm->base, data);
}

Expand Down

0 comments on commit 51679e3

Please sign in to comment.