From d8d352a11a12068a9d54130814edf937491eab02 Mon Sep 17 00:00:00 2001 From: katsy <katmint@live.com> Date: Tue, 22 Aug 2023 15:11:47 -0500 Subject: [PATCH] fix some issues with supername code --- src/r_skins.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/r_skins.c b/src/r_skins.c index 3e918de6e..72598f381 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -772,12 +772,12 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile) strupr(skin->hudname); SYMBOLCONVERT(skin->hudname) } - else if (!supername) + if (!supername) { - char super[7], someone[SKINNAMESIZE+1]; - strcpy(super, "Super "); - strcpy(someone, skin->realname); - STRBUFCPY(skin->supername, strcat(super, someone)); + char superstring[SKINNAMESIZE+7]; + strcpy(superstring, "Super "); + strlcat(superstring, skin->name, sizeof(superstring)); + STRBUFCPY(skin->supername, superstring); } } else if (!stricmp(stoken, "supername")) @@ -795,10 +795,10 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile) HUDNAMEWRITE(skin->realname); if (!supername) //copy over default to capitalise the name { - char super[7], someone[SKINNAMESIZE+1]; - strcpy(super, "Super "); - strcpy(someone, skin->realname); - STRBUFCPY(skin->supername, strcat(super, someone)); + char superstring[SKINNAMESIZE+7]; + strcpy(superstring, "Super "); + strlcat(superstring, skin->realname, sizeof(superstring)); + STRBUFCPY(skin->supername, superstring); } } else if (!stricmp(stoken, "hudname")) @@ -930,10 +930,10 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile) HUDNAMEWRITE(skin->realname); if (!supername) //copy over default to capitalise the name { - char super[7], someone[SKINNAMESIZE+1]; - strcpy(super, "Super "); - strcpy(someone, skin->realname); - STRBUFCPY(skin->supername, strcat(super, someone)); + char superstring[SKINNAMESIZE+7]; + strcpy(superstring, "Super "); + strlcat(superstring, skin->realname, sizeof(superstring)); + STRBUFCPY(skin->supername, superstring); } } else if (!stricmp(stoken, "hudname")) -- GitLab