Closed
Bug 507368
Opened 16 years ago
Closed 9 years ago
main should check failure of calloc instead of delegating to GetRealPath
Categories
(Toolkit Graveyard :: XULRunner, enhancement)
Toolkit Graveyard
XULRunner
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: timeless, Assigned: timeless)
References
()
Details
(Keywords: coverity)
Attachments
(1 file)
945 bytes,
patch
|
benjamin
:
review-
|
Details | Diff | Splinter Review |
349 char *result = (char*) calloc(sizeof(char), MAXPATHLEN);
350 if (NS_FAILED(GetRealPath(appDataFile, &result))) {
155 static nsresult GetRealPath(const char* appDataFile, char* *aResult)
165 if (!realpath(appDataFile, *aResult) || stat(*aResult, &fileStat))
168 if (!*aResult || !**aResult)
*aResult is dereferenced by realpath, so the null check doesn't work
Comment 2•16 years ago
|
||
Comment on attachment 391583 [details] [diff] [review]
patch
> char *result = (char*) calloc(sizeof(char), MAXPATHLEN);
>+ if (!*result) {
That doesn't look right, don't you mean `if (!result)`?
>+ Output(PR_TRUE, "Out of memory");
>+ return 1;
>+ }
>+
> if (NS_FAILED(GetRealPath(appDataFile, &result))) {
> Output(PR_TRUE, "Invalid application.ini path.\n");
> return 1;
Attachment #391583 -
Flags: review?(benjamin) → review-
Comment 3•9 years ago
|
||
XULRunner has been removed from the Mozilla tree: see https://groups.google.com/forum/#!topic/mozilla.dev.platform/_rFMunG2Bgw for context.
I am closing all the bugs currently in the XULRunner bugzilla component, in preparation for moving this component to the graveyard. If this bug is still valid in a XULRunner-less world, it will need to be moved to a different bugzilla component to be reopened.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → INCOMPLETE
Updated•9 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•