diff --git a/include/Asm/arch.h b/include/Asm/arch.h index b5b1430..b951497 100644 --- a/include/Asm/arch.h +++ b/include/Asm/arch.h @@ -175,7 +175,8 @@ typedef struct _AsmArchInstructionCall { char const * prefix; char const * name; - AsmArchOperand operands[5]; +# define ARO_COUNT 5 + AsmArchOperand operands[ARO_COUNT]; uint32_t operands_cnt; /* meta information */ diff --git a/src/arch/i386.h b/src/arch/i386.h index 1bd76ab..14745f0 100644 --- a/src/arch/i386.h +++ b/src/arch/i386.h @@ -522,7 +522,7 @@ static int _i386_encode(AsmArchPlugin * plugin, AsmArchInstructionCall const * call) { uint32_t i; - AsmArchOperandDefinition definitions[3]; + AsmArchOperandDefinition definitions[ARO_COUNT]; #ifdef DEBUG fprintf(stderr, "DEBUG: %s(\"%s\")\n", __func__, instruction->name); @@ -534,6 +534,8 @@ static int _i386_encode(AsmArchPlugin * plugin, definitions[0] = instruction->op1; definitions[1] = instruction->op2; definitions[2] = instruction->op3; + for(i = 3; i < sizeof(definitions) / sizeof(*definitions); i++) + definitions[i] = 0x0; for(i = 0; i < call->operands_cnt; i++) if(_encode_operand(plugin, &i, definitions, call->operands) != 0)