[physfs] Bug - "file not found" if path is substring of another file
napalminc at gmail.com
Tue Sep 4 19:22:47 EDT 2012
I believe I might have found a bug in PhysFS in checking for the
existance of a file whose name it is a substring of another file. In
the following code, I believe that PHYSFS_exists() should return
$ cat main.c
int main(int argc, char *argv)
$ cat build.sh
zip bar.zip foo foo.a xyz
gcc main.c -o main -lphysfs
if [ "$?" -eq "0" ]; then
I have only looked at the ZIP archiver, but this can be fixed to
return the correct value if in zip_find_entry(), when a substring is
matched, "hi" is always modified, "lo" never.
-else if (thispath[pathlen] > '/')
hi = middle - 1;
- lo = middle + 1;
I am not sure how this change plays out with the isDir subtleties, and
this change might cause problems with that. I have not thoroughly
tested for anything of the sort.
Also, I have not investigated the other archiver modules to see if
they are similarly affected. It might be worth a check.
More information about the physfs