]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix a stack smash possibility in loadimagepixels
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 2 Jun 2005 09:51:34 +0000 (09:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 2 Jun 2005 09:51:34 +0000 (09:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5376 d7cf8633-e32d-0410-b094-e92efae38249

image.c

diff --git a/image.c b/image.c
index 077baa7f7214bca6e9783cbe5631a52ebc157805..ebed474304d363f9e75d7af9a7d5169247d0dea2 100644 (file)
--- a/image.c
+++ b/image.c
@@ -692,7 +692,8 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth,
                Mem_CheckSentinelsGlobal();
        if (developer_texturelogging.integer)
                Log_Printf("textures.log", "%s\n", filename);
-       Image_StripImageExtension(filename, basename); // strip filename extensions to allow replacement by other types
+       strlcpy(basename, filename, sizeof(basename));
+       Image_StripImageExtension(basename, basename); // strip filename extensions to allow replacement by other types
        // replace *'s with #, so commandline utils don't get confused when dealing with the external files
        for (c = basename;*c;c++)
                if (*c == '*')
@@ -1521,7 +1522,8 @@ int image_loadskin(imageskin_t *s, char *shadername)
        qbyte *bumppixels;
        int bumppixels_width, bumppixels_height;
        char name[MAX_QPATH];
-       Image_StripImageExtension(shadername, name);
+       strlcpy(name, shadername, sizeof(name));
+       Image_StripImageExtension(name, name);
        memset(s, 0, sizeof(*s));
        s->basepixels = loadimagepixels(name, false, 0, 0);
        if (s->basepixels == NULL)