From DONOTREPLY at icculus.org Sat Aug 20 00:46:26 2005 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 20 Aug 2005 00:46:26 -0400 Subject: r761 - trunk Message-ID: <20050820044626.2431.qmail@icculus.org> Author: icculus Date: 2005-08-20 00:46:25 -0400 (Sat, 20 Aug 2005) New Revision: 761 Modified: trunk/CHANGELOG trunk/physfs.c Log: Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig() and other corner cases. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2005-07-25 01:38:07 UTC (rev 760) +++ trunk/CHANGELOG 2005-08-20 04:46:25 UTC (rev 761) @@ -2,6 +2,8 @@ * CHANGELOG. */ +08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig() + and other corner cases. 07242005 - Patched to compile on BeOS. 07232005 - Fixed bug in zip archiver (thanks, J?rg Walter!). More minor OS/2 tweaks. Updated zlib to 1.2.3, which properly Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2005-07-25 01:38:07 UTC (rev 760) +++ trunk/physfs.c 2005-08-20 04:46:25 UTC (rev 761) @@ -1107,7 +1107,7 @@ BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); - /* set write dir... */ + /* set write dir... */ str = (char *) allocator.Malloc( strlen(userdir) + (strlen(organization) * 2) + (strlen(appName) * 2) + (strlen(dirsep) * 3) + 2); @@ -1325,13 +1325,15 @@ { while (1) { + int rc = 0; end = strchr(start, '/'); - if (end != NULL) - *end = '\0'; - if (h->funcs->isSymLink(h->opaque, fname, &retval)) - BAIL_MACRO(ERR_SYMLINK_DISALLOWED, 0); /* insecure. */ + if (end != NULL) *end = '\0'; + rc = h->funcs->isSymLink(h->opaque, fname, &retval); + if (end != NULL) *end = '/'; + BAIL_IF_MACRO(rc, ERR_SYMLINK_DISALLOWED, 0); /* insecure. */ + /* break out early if path element is missing. */ if (!retval) { @@ -1348,7 +1350,6 @@ if (end == NULL) break; - *end = '/'; start = end + 1; } /* while */ } /* if */