Closed Bug 15749 Opened 25 years ago Closed 25 years ago

nsSpecialSystemDirectory ctor does bad call to nsFileSpec ctor

Categories

(Core :: XPCOM, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: sfraser_bugs, Assigned: sfraser_bugs)

Details

The constructor of nsSpecialSystemDirectory constructs its base class, nsFileSpec, like nsFileSpec(null). This calls the ctor nsFileSpec::nsFileSpec(const char* inNativePathString, PRBool inCreateDirs) which is not designed to handle a null inNativePathString, and ends up calling strlen and strchr on *nil on Mac.
I think the correct fix is to check for null input strings in nsFileSpec: < mError = NS_FILE_RESULT( < MacFileHelpers::FSSpecFromPathname( < inNativePathString, < mSpec, inCreateDirs)); < if (mError == NS_FILE_RESULT(fnfErr)) < mError = NS_OK; < --- > if (inNativePathString) > { > mError = NS_FILE_RESULT(MacFileHelpers::FSSpecFromPathname( > inNativePathString, > mSpec, inCreateDirs)); > if (mError == NS_FILE_RESULT(fnfErr)) > mError = NS_OK; > } > else > { > mError = NS_ERROR_NOT_INITIALIZED; > } > and < mError = NS_FILE_RESULT( < MacFileHelpers::FSSpecFromPathname(inString, mSpec, true)); < if (mError == NS_FILE_RESULT(fnfErr)) < mError = NS_OK; --- > if (inString) > { > mError = NS_FILE_RESULT(MacFileHelpers::FSSpecFromPathname(inString, mSpec, true)); > if (mError == NS_FILE_RESULT(fnfErr)) > mError = NS_OK; > } > else > { > mError = NS_ERROR_NOT_INITIALIZED; > }
changes look good. check um in!
Assignee: dougt → sfraser
I'll take this
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix checked in to nsFileSpecMac.cpp
marking verified and setting milestone
Status: RESOLVED → VERIFIED
Target Milestone: --- → M10
You need to log in before you can comment on or make changes to this bug.