From 2f0d3e2189d5ce3702110f5efc71c1abc25a9ddb Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Tue, 16 Apr 2024 00:12:43 +0300 Subject: [PATCH] render: support texture name with full field size --- src/client/refresh/files/maps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/refresh/files/maps.c b/src/client/refresh/files/maps.c index 2aa0f17d..5643e752 100644 --- a/src/client/refresh/files/maps.c +++ b/src/client/refresh/files/maps.c @@ -505,6 +505,7 @@ Mod_LoadTexinfoQ2(const char *name, mtexinfo_t **texinfo, int *numtexinfo, { struct image_s *image; int j, next; + char imagename[sizeof(in->texture) + 1]; for (j = 0; j < 4; j++) { @@ -529,11 +530,14 @@ Mod_LoadTexinfoQ2(const char *name, mtexinfo_t **texinfo, int *numtexinfo, out->next = NULL; } - image = GetTexImage(in->texture, find_image); + memcpy(imagename, in->texture, sizeof(in->texture)); + /* add last zero if name is too long */ + imagename[sizeof(in->texture)] = 0; + image = GetTexImage(imagename, find_image); if (!image) { R_Printf(PRINT_ALL, "%s: Couldn't load %s\n", - __func__, in->texture); + __func__, imagename); image = notexture; }