Closed Bug 1344223 Opened 3 years ago Closed 3 years ago

unchecked result of mktemp before passing to fdopen

Categories

(Core :: XPCOM, enhancement)

52 Branch
enhancement
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jesup, Assigned: jesup)

Details

Attachments

(1 file)

Long-standing minor bug

** CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
/xpcom/build/LateWriteChecks.cpp: 161 in LateWriteObserver::Observe(mozilla::IOInterposeObserver::Observation &)()


________________________________________________________________________________________________________
*** CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
/xpcom/build/LateWriteChecks.cpp: 161 in LateWriteObserver::Observe(mozilla::IOInterposeObserver::Observation &)()
155         MOZ_CRASH("Um, how did we get here?");
156       }
157     
158       stream = _fdopen(fd, "w");
159     #else
160       int fd = mkstemp(name);
>>>     CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "fd" is passed to a parameter that cannot be negative.
161       stream = fdopen(fd, "w");
162     #endif
163     
164       SHA1Stream sha1Stream(stream);
165     
166       size_t numModules = stack.GetNumModules();
MozReview-Commit-ID: 1z3cQXioTXP
Attachment #8843326 - Flags: review?(nfroyd)
Comment on attachment 8843326 [details] [diff] [review]
error-check mkstemp()

Review of attachment 8843326 [details] [diff] [review]:
-----------------------------------------------------------------

I guess this is consistent with the Windows code, but it seems like we should just return in both cases if we can't get a temp file.  Anyway, r=me.
Attachment #8843326 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/acf2c7b496d5
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.