arch/X86: fix strncpy usage (#1243)

The `n` parameter should be the size of the destination buffer, not the
source one.
This commit is contained in:
Riccardo Schirone 2018-09-04 03:51:02 +02:00 committed by Nguyen Anh Quynh
parent 67b9a2174f
commit 5212dc571a
2 changed files with 2 additions and 2 deletions

View File

@ -881,7 +881,7 @@ void X86_ATT_printInst(MCInst *MI, SStream *OS, void *info)
// perhaps this instruction does not need printer
if (MI->assembly[0]) {
strncpy(OS->buffer, MI->assembly, sizeof(MI->assembly));
strncpy(OS->buffer, MI->assembly, sizeof(OS->buffer));
return;
}

View File

@ -742,7 +742,7 @@ void X86_Intel_printInst(MCInst *MI, SStream *O, void *Info)
// perhaps this instruction does not need printer
if (MI->assembly[0]) {
strncpy(O->buffer, MI->assembly, sizeof(MI->assembly));
strncpy(O->buffer, MI->assembly, sizeof(O->buffer));
return;
}