# HG changeset patch # User rubidium # Date 1180621759 0 # Node ID 51195486289c9e672840a464d15d131eb988e970 # Parent 8a92d98ecb197ff747e865b83401c9d33ea34447 (svn r9998) -Fix (r9990): possible null pointer dereferences on MorphOS. diff -r 8a92d98ecb19 -r 51195486289c src/fios.cpp --- a/src/fios.cpp Thu May 31 14:16:22 2007 +0000 +++ b/src/fios.cpp Thu May 31 14:29:19 2007 +0000 @@ -114,11 +114,12 @@ case FIOS_TYPE_PARENT: /* Check for possible NULL ptr (not required for UNIXes, but AmigaOS-alikes) */ - if ((s = strrchr(path, PATHSEPCHAR)) != path) { + s = strrchr(path, PATHSEPCHAR); + if (s != NULL && s != path) { s[0] = '\0'; // Remove last path separator character, so we can go up one level. - s = strrchr(path, PATHSEPCHAR); - if (s != NULL) s[1] = '\0'; // go up a directory } + s = strrchr(path, PATHSEPCHAR); + if (s != NULL) s[1] = '\0'; // go up a directory #if defined(__MORPHOS__) || defined(__AMIGAOS__) /* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */ else if ((s = strrchr(path, ':')) != NULL) s[1] = '\0';