foxygit / doom Log in
commit 9a8f5dc9d9e9ec83e49b53daf208ea39b01fdab4
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Sun May 6 13:23:02 2018 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Sun May 6 13:23:02 2018 +0200

    w_merge.c: replace strncpy() with memcpy() in FindSpriteFrame()

    The sprname field of struct sprite_frame_t is supposed to contain the
    four byte prefix for the sprite names, not an actual string with a
    NULL byte delimiter.

    This fixes a new compiler warning detected by @turol, fixes #1031.

    Thanks @turol and @AXDOOMER for the discussion!
---
 src/w_merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/w_merge.c b/src/w_merge.c
index f9cf06ea..2c525a24 100644
--- a/src/w_merge.c
+++ b/src/w_merge.c
@@ -216,7 +216,7 @@ static sprite_frame_t *FindSpriteFrame(char *name, int frame)
     // Add to end of list

     result = &sprite_frames[num_sprite_frames];
-    strncpy(result->sprname, name, 4);
+    memcpy(result->sprname, name, 4);
     result->frame = frame;

     for (i=0; i<8; ++i)