Closed
Bug 15749
Opened 25 years ago
Closed 25 years ago
nsSpecialSystemDirectory ctor does bad call to nsFileSpec ctor
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
VERIFIED
FIXED
M10
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.
Assignee | ||
Comment 1•25 years ago
|
||
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;
> }
Comment 2•25 years ago
|
||
changes look good. check um in!
Assignee | ||
Updated•25 years ago
|
Assignee: dougt → sfraser
Assignee | ||
Comment 3•25 years ago
|
||
I'll take this
Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 4•25 years ago
|
||
Fix checked in to nsFileSpecMac.cpp
Comment 5•25 years ago
|
||
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.
Description
•