arch/X86: fix strncpy usage (#1243)
The `n` parameter should be the size of the destination buffer, not the
source one.
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index 252b828..a89159d 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -881,7 +881,7 @@
// 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;
}
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 607bca3..3158e70 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -742,7 +742,7 @@
// 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;
}