This commit is contained in:
twinaphex 2020-06-23 14:05:44 +02:00
parent 14d5d40efc
commit 3db0ffaa04

View File

@ -203,12 +203,15 @@ static int WriteStateChunk(StateMem *st, const char *sname, SFORMAT *sf)
int32_t end_pos;
uint8_t sname_tmp[32];
size_t sname_len = strlen(sname);
memset(sname_tmp, 0, sizeof(sname_tmp));
memcpy((char *)sname_tmp, sname, 32);
memcpy((char *)sname_tmp, sname, (sname_len < 32) ? sname_len : 32);
if(strlen(sname) > 32)
#ifndef NDEBUG
if(sname_len > 32)
printf("Warning: section name is too long: %s\n", sname);
#endif
smem_write(st, sname_tmp, 32);