]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
critical fix for COM_FileBase (could go hunting through mem for /)
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 7 Jan 2001 16:49:54 +0000 (16:49 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 7 Jan 2001 16:49:54 +0000 (16:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@125 d7cf8633-e32d-0410-b094-e92efae38249

common.c

index e31b48d7605b8d089bd2c87dc3d472e9806ce31f..e2b9c30524383b0efd4018d1c8b04c9793ba25fe 100644 (file)
--- a/common.c
+++ b/common.c
@@ -893,13 +893,15 @@ void COM_FileBase (char *in, char *out)
        while (s != in && *s != '.')
                s--;
        
        while (s != in && *s != '.')
                s--;
        
-       for (s2 = s ; *s2 && *s2 != '/' ; s2--)
+       // LordHavoc: EWW bug bug bug bug bug... added previously missing s2 != in (yes, could go hunting through mem for /)
+       for (s2 = s ; s2 != in && *s2 && *s2 != '/' ; s2--)
        ;
        
        if (s-s2 < 2)
                strcpy (out,"?model?");
        else
        {
        ;
        
        if (s-s2 < 2)
                strcpy (out,"?model?");
        else
        {
+               // LordHavoc: FIXME: examine this
                s--;
                strncpy (out,s2+1, s-s2);
                out[s-s2] = 0;
                s--;
                strncpy (out,s2+1, s-s2);
                out[s-s2] = 0;