shithub: qk1

Download patch

ref: 79050578c7fb0a2efc4c4d9c04ba63738fb5f660
parent: fe2a32889ef6968fb533876bf2492927a9406344
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Oct 15 00:24:36 EDT 2024

bsp models: some of them have rather long names - increase the buffer size and don't use strcpy

--- a/model_bsp.c
+++ b/model_bsp.c
@@ -253,7 +253,7 @@
 {
 	int i, litsz;
 	byte *lit;
-	char s[64], *t;
+	char s[128+1], *t;
 
 	if(sz == 0){
 		mod->lightdata = nil;
@@ -260,7 +260,7 @@
 		return 0;
 	}
 
-	strcpy(s, mod->name);
+	snprint(s, sizeof(s), "%s", mod->name);
 	if((t = strrchr(s, '.')) != nil){
 		strcpy(t, ".lit");
 		if((lit = loadhunklmp(s, &litsz)) != nil && litsz >= 4+4+sz*3){
@@ -322,7 +322,7 @@
 int
 BSP_LoadVisibility(model_t *mod, byte *in, int sz)
 {
-	char s[32+1], *t;
+	char s[128+1], *t;
 	byte *vis, *leaf;
 	int filesz, combined, vissz, leafsz;
 
@@ -333,7 +333,7 @@
 	// external vis files
 	// FIXME(sigrid): add support for big combo ("id1.vis") files?
 	if(mod->ver == BSPVERSION){ // bsp2 should have proper vis built in already
-		strcpy(s, mod->name);
+		snprint(s, sizeof(s)-4, "%s", mod->name);
 		if((t = strrchr(s, '.')) != nil){
 			strcpy(t, ".vis");
 			if((t = strrchr(mod->name, '/')) != nil)