diff --git a/src/files/models.c b/src/files/models.c index 9c81ddb..78e807f 100644 --- a/src/files/models.c +++ b/src/files/models.c @@ -983,11 +983,13 @@ Mod_LoadFile(char *name, void **buffer) } /* Remove the extension */ + size_t tlen = len - (strlen(ext) + 1); memset(namewe, 0, 256); - memcpy(namewe, name, len - (strlen(ext) + 1)); + memcpy(namewe, name, tlen); /* Check Heretic2 model */ - snprintf(newname, sizeof(newname), "%s.fm", namewe); + Q_strlcpy(newname, namewe, sizeof(newname)); + Q_strlcat(newname, ".fm", sizeof(newname)); filesize = ri.FS_LoadFile (newname, buffer); if (filesize > 0) { @@ -995,7 +997,7 @@ Mod_LoadFile(char *name, void **buffer) } /* Check Quake 2 model */ - snprintf(newname, sizeof(newname), "%s.md2", namewe); + Q_strlcpy(newname + tlen, ".md2", sizeof(newname)); filesize = ri.FS_LoadFile (newname, buffer); if (filesize > 0) { @@ -1003,7 +1005,7 @@ Mod_LoadFile(char *name, void **buffer) } /* Check Quake model */ - snprintf(newname, sizeof(newname), "%s.mdl", namewe); + Q_strlcpy(newname + tlen, ".mdl", sizeof(newname)); filesize = ri.FS_LoadFile (newname, buffer); if (filesize > 0) { diff --git a/src/vk/vk_image.c b/src/vk/vk_image.c index 7a87e3c..4eab4ae 100644 --- a/src/vk/vk_image.c +++ b/src/vk/vk_image.c @@ -1199,6 +1199,8 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth, image->upload_width = upload_width; // after power of 2 and scales image->upload_height = upload_height; + assert(texBuffer != NULL); + QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer, image->upload_width, image->upload_height, nolerp ? S_NEAREST : vk_current_sampler, (type == it_sky));