diff options
author | Pale Moon <git-repo@palemoon.org> | 2018-07-10 17:51:36 +0200 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2018-07-10 17:51:36 +0200 |
commit | fb0d956a2e8981d985a55dfa555b185543cbdcd7 (patch) | |
tree | 0bb92ea106629be9f3ce6857f84d2c20ccd29fc7 | |
parent | 3a1c74207fe8b7ee2205632df70daf6d18e3cbe6 (diff) | |
parent | 9ced226336e2ef5c88be3179519d19fcdf8b0aee (diff) | |
download | palemoon-27.9_RelBranch.tar.gz |
Merge branch 'master' into 27.9_RelBranch27.9.4_Release27.9_RelBranch
-rw-r--r-- | netwerk/base/nsFileStreams.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/netwerk/base/nsFileStreams.cpp b/netwerk/base/nsFileStreams.cpp index 8b719df20..1946fc7f5 100644 --- a/netwerk/base/nsFileStreams.cpp +++ b/netwerk/base/nsFileStreams.cpp @@ -907,11 +907,18 @@ nsAtomicFileOutputStream::DoOpen() } if (NS_SUCCEEDED(rv) && mTargetFileExists) { + // Abort if |file| is not writable; it won't work as an output stream. + bool isWritable; + if (NS_SUCCEEDED(file->IsWritable(&isWritable)) && !isWritable) { + return NS_ERROR_FILE_ACCESS_DENIED; + } + uint32_t origPerm; if (NS_FAILED(file->GetPermissions(&origPerm))) { NS_ERROR("Can't get permissions of target file"); origPerm = mOpenParams.perm; } + // XXX What if |perm| is more restrictive then |origPerm|? // This leaves the user supplied permissions as they were. rv = tempResult->CreateUnique(nsIFile::NORMAL_FILE_TYPE, origPerm); |