fix segfault in vsnprintf on 32 bit systems examining a PPC ELF (#8075)

* fix segfault in vsnprintf on 32 bit systems 

On a 32-bit x86 computer, examining a PowerPC ELF with the "aa" command caused a segfault in vsnprintf. 

The %llx  (PFMT64x) format attempts to get the next 64 bits from the stack. This will consume the cmask32 and ARG(0) values. The following "%s" will cause a segfault if the next 32 bits is not pointing to readable memory.

I doubt this is the best fix. Maybe libr/include/r_types.h should be changed? You guys know better.

* cast instead of duplicating code

* fix white space
This commit is contained in:
Dennis Goodlett 2017-08-01 12:20:39 -04:00 committed by radare
parent 1820908da3
commit 66b5808475

View File

@ -623,7 +623,7 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
break;
case PPC_INS_CLRLWI:
op->type = R_ANAL_OP_TYPE_AND;
esilprintf (op, "%s,0x%"PFMT64x",&,%s,=", ARG (1), cmask32 (ARG (2), "31"), ARG (0));
esilprintf (op, "%s,0x%"PFMT64x",&,%s,=", ARG (1), (ut64) cmask32 (ARG (2), "31"), ARG (0));
break;
case PPC_INS_RLWINM:
op->type = R_ANAL_OP_TYPE_ROL;