Fix for bug 15749; passing null strings to nsFileSpec routines was doing bad things, like strlen(NULL). r=dougt

This commit is contained in:
sfraser%netscape.com 1999-10-07 20:57:21 +00:00
Родитель b34db65450
Коммит a20752a6fd
1 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -642,12 +642,17 @@ nsFileSpec::nsFileSpec(const char* inNativePathString, PRBool inCreateDirs)
mSpec.vRefNum = 0;
mSpec.parID = 0;
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;
}
} // nsFileSpec::nsFileSpec
@ -698,10 +703,16 @@ void nsFileSpec::operator = (const char* inString)
mSpec.vRefNum = 0;
mSpec.parID = 0;
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;
}
} // nsFileSpec::operator =