# HG changeset patch # User rubidium # Date 2007-05-31 14:29:19 # Node ID 51e34be35206d3746a32b93917f7f6e86a1a73d1 # Parent e60603ff16c2cb5e386d065b9515cb67dadea789 (svn r9998) -Fix (r9990): possible null pointer dereferences on MorphOS. diff --git a/src/fios.cpp b/src/fios.cpp --- a/src/fios.cpp +++ b/src/fios.cpp @@ -114,11 +114,12 @@ char *FiosBrowseTo(const FiosItem *item) 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';