From: lordhavoc Date: Sun, 7 Jan 2001 16:49:54 +0000 (+0000) Subject: critical fix for COM_FileBase (could go hunting through mem for /) X-Git-Tag: RELEASE_0_2_0_RC1~895 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1530c917b5032e4fd625d3dddfa2d09c107838de;p=xonotic%2Fdarkplaces.git critical fix for COM_FileBase (could go hunting through mem for /) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@125 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/common.c b/common.c index e31b48d7..e2b9c305 100644 --- a/common.c +++ b/common.c @@ -893,13 +893,15 @@ void COM_FileBase (char *in, char *out) 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 { + // LordHavoc: FIXME: examine this s--; strncpy (out,s2+1, s-s2); out[s-s2] = 0;