Skip to content

Commit

Permalink
Use memcpy instead of strncpy
Browse files Browse the repository at this point in the history
It's not supposed to have a '\0' at the end and if it's 8 letters it
should end in a letter, so str* functions aren't the right choice.
Silences a compiler warning.
  • Loading branch information
MasterDuke17 committed Apr 28, 2020
1 parent bbb0cdb commit 9294cbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/profiler/heapsnapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,8 @@ void serialize_attribute_stream(MVMThreadContext *tc, MVMHeapSnapshotCollection
}

{
char namebuf[8];
strncpy(namebuf, name, 8);
char namebuf[8] = {0};
memcpy(namebuf, name, 8);
fwrite(namebuf, 8, 1, fh);
}

Expand Down

0 comments on commit 9294cbf

Please sign in to comment.