shithub: choc

Download patch

ref: 9a8f5dc9d9e9ec83e49b53daf208ea39b01fdab4
parent: 00311e89f5bc707c333c38b5f1850d2f2a35e076
author: Fabian Greffrath <fabian@greffrath.com>
date: Sun May 6 09:23:02 EDT 2018

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!

--- a/src/w_merge.c
+++ b/src/w_merge.c
@@ -216,7 +216,7 @@
     // 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)