Permalink
Browse files

Fix #6268 - Deanonymize the AVR union

  • Loading branch information...
1 parent 72e874c commit 13c15cb0a2593a6cc5c9d12a0c847e033a7cf16e @radare committed Dec 1, 2016
Showing with 5 additions and 5 deletions.
  1. +5 −5 libr/anal/p/anal_avr.c
@@ -30,7 +30,7 @@ typedef struct _cpu_model_tag {
struct _cpu_model_tag *inherit_cpu_p;
union {
CPU_CONST *consts[10];
- };
+ } u;
} CPU_MODEL;
typedef void (*inst_handler_t) (RAnal *anal, RAnalOp *op, const ut8 *buf, int *fail, CPU_MODEL *cpu);
@@ -109,15 +109,15 @@ CPU_CONST cpu_pagesize_7_bits[] = {
CPU_MODEL cpu_models[] = {
{
.model = "ATmega8", .pc = 13,
- .consts = {
+ .u.consts = {
cpu_reg_common,
cpu_memsize_common,
cpu_pagesize_5_bits,
NULL
}
},
{ .model = "ATmega640", .pc = 15,
- .consts = {
+ .u.consts = {
cpu_reg_common,
cpu_memsize_m640_m1280m_m1281_m2560_m2561,
cpu_pagesize_7_bits,
@@ -176,7 +176,7 @@ static ut32 const_get_value(CPU_CONST *c) {
static CPU_CONST *const_by_name(CPU_MODEL *cpu, int type, char *c) {
CPU_CONST **clist, *citem;
- for (clist = cpu->consts; *clist; clist++) {
+ for (clist = cpu->u.consts; *clist; clist++) {
for (citem = *clist; citem->key; citem++) {
if (!strcmp (c, citem->key)
&& (type == CPU_CONST_NONE || type == citem->type)) {
@@ -203,7 +203,7 @@ static int __esil_pop_argument(RAnalEsil *esil, ut64 *v) {
static CPU_CONST *const_by_value(CPU_MODEL *cpu, int type, ut32 v) {
CPU_CONST **clist, *citem;
- for (clist = cpu->consts; *clist; clist++) {
+ for (clist = cpu->u.consts; *clist; clist++) {
for (citem = *clist; citem && citem->key; citem++) {
if (citem->value == (MASK (citem->size * 8) & v)
&& (type == CPU_CONST_NONE || type == citem->type)) {

0 comments on commit 13c15cb

Please sign in to comment.