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)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: timeless, Assigned: timeless)

References

()

Details

(Keywords: coverity)

Attachments

(1 file)

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
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #391583 - Flags: review?(benjamin)
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-
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
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: