Resize menudemo_t filepath to fix -Wformat-truncation

This commit is contained in:
James R 2023-01-05 04:24:18 -08:00
parent e78625455e
commit e7af4a5084
2 changed files with 4 additions and 2 deletions

View file

@ -82,7 +82,7 @@ typedef enum {
} menudemotype_e; } menudemotype_e;
struct menudemo_t { struct menudemo_t {
char filepath[256]; char filepath[1023 + 256]; // see M_PrepReplayList and sizeof menupath
menudemotype_e type; menudemotype_e type;
char title[65]; // Null-terminated for string prints char title[65]; // Null-terminated for string prints

View file

@ -6621,7 +6621,9 @@ void M_PrepReplayList(void)
else else
{ {
extrasmenu.demolist[i].type = MD_NOTLOADED; extrasmenu.demolist[i].type = MD_NOTLOADED;
snprintf(extrasmenu.demolist[i].filepath, 255, "%s%s", menupath, dirmenu[i] + DIR_STRING); snprintf(extrasmenu.demolist[i].filepath, sizeof extrasmenu.demolist[i].filepath,
// 255 = UINT8 limit. dirmenu entries are restricted to this length (see DIR_LEN).
"%s%.255s", menupath, dirmenu[i] + DIR_STRING);
sprintf(extrasmenu.demolist[i].title, "....."); sprintf(extrasmenu.demolist[i].title, ".....");
} }
} }