summaryrefslogtreecommitdiff
path: root/yjit_iface.c
diff options
context:
space:
mode:
authorNoah Gibbs <noah.gibbs@shopify.com>2021-06-29 19:34:05 +0100
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:37 -0400
commitdb02d73e5e0489dd2028ea4b9572361ed5aa2cc9 (patch)
tree6979d96f1962b2bda33ee001a30d8b8d51be5e95 /yjit_iface.c
parent5e164a77d536e0eea9c76ade036a3ff4d14176c3 (diff)
Change strcpy of a static string to strncpy
Diffstat (limited to 'yjit_iface.c')
-rw-r--r--yjit_iface.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/yjit_iface.c b/yjit_iface.c
index 83ca0b4e82..ed47112052 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -766,7 +766,7 @@ get_yjit_stats(rb_execution_context_t *ec, VALUE self)
// where the value is the count of side exits for that instruction.
char key_string[rb_vm_max_insn_name_size + 6]; // Leave room for "exit_" and a final NUL
- strcpy(key_string, "exit_");
+ strncpy(key_string, "exit_", 6); // Copy 6 characters to include the NUL.
for (int i = 0; i < VM_INSTRUCTION_SIZE; i++) {
const char *i_name = insn_name(i); // Look up Ruby's NUL-terminated insn name string
strncpy(key_string + 5, i_name, rb_vm_max_insn_name_size + 1);