[v5] Fix unintended zero set in Sparc printInst (#2420)

This commit is contained in:
david942j 2024-08-04 18:52:07 +08:00 committed by GitHub
parent a904d0b9f3
commit d31d979a1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -354,9 +354,9 @@ void Sparc_printInst(MCInst *MI, SStream *O, void *Info)
mnem = printAliasInstr(MI, O, Info);
if (mnem) {
// fixup instruction id due to the change in alias instruction
unsigned cpy_len = sizeof(instr) < strlen(mnem) ? sizeof(instr) : strlen(mnem);
unsigned cpy_len = sizeof(instr) - 1 < strlen(mnem) ? sizeof(instr) - 1 : strlen(mnem);
memcpy(instr, mnem, cpy_len);
instr[cpy_len - 1] = '\0';
instr[cpy_len] = '\0';
// does this contains hint with a coma?
p = strchr(instr, ',');
if (p)

View File

@ -1054,3 +1054,7 @@
!# issue 2244
!# CS_ARCH_X86, CS_MODE_64, CS_OPT_DETAIL
0x0: 0xc5,0xfb,0xc2,0xda,0x06 == vcmpnlesd xmm3, xmm0, xmm2 ; ID: 797
!# issue 2419
!# CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN, CS_OPT_DETAIL
0x0: 0x12,0xbf,0xff,0xff == bne -4 ; Code condition: 265