Skip to content

Commit

Permalink
Replace strcpy with strncpy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Sep 5, 2024
1 parent 20edb70 commit 89a0e3f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions arch/XCore/XCoreInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

#ifdef CAPSTONE_HAS_XCORE

#ifdef _MSC_VER
#pragma warning(disable : 4996) // disable MSVC's warning on strcpy()
#pragma warning(disable : 28719) // disable MSVC's warning on strcpy()
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -51,7 +46,7 @@ void XCore_insn_extract(MCInst *MI, const char *code)
char *p, *p2;
char tmp[128];

strcpy(tmp, code); // safe because code is way shorter than 128 bytes
strncpy(tmp, code, sizeof(tmp) - 1); // safe because code is way shorter than 128 bytes

// find the first space
p = strchr(tmp, ' ');
Expand Down

0 comments on commit 89a0e3f

Please sign in to comment.