Tracker: Fix dereference after NULL, CID 601541
_TrackerLaunchDocuments() dereferences refs to copy it, so, we need check that it isn't NULL first. Also a few style fixes. * Name params consistent with TTracker class methods ref, message => appRef, refs * Use NULL instead of 0 for NULL pointer.
This commit is contained in:
parent
58121655ed
commit
ab28908d2d
@ -3474,9 +3474,12 @@ LoaderErrorDetails(const entry_ref* app, BString &details)
|
||||
|
||||
|
||||
static void
|
||||
_TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs,
|
||||
_TrackerLaunchDocuments(const entry_ref*, const BMessage* refs,
|
||||
bool openWithOK)
|
||||
{
|
||||
if (refs == NULL)
|
||||
return;
|
||||
|
||||
BMessage copyOfRefs(*refs);
|
||||
|
||||
entry_ref documentRef;
|
||||
@ -3700,7 +3703,7 @@ status_t
|
||||
TrackerLaunch(const entry_ref* appRef, bool async)
|
||||
{
|
||||
if (!async)
|
||||
_TrackerLaunchAppWithDocuments(appRef, 0, false);
|
||||
_TrackerLaunchAppWithDocuments(appRef, NULL, false);
|
||||
else
|
||||
AsynchLaunchBinder(&_TrackerLaunchAppWithDocuments, appRef, 0, false);
|
||||
|
||||
@ -3711,9 +3714,9 @@ status_t
|
||||
TrackerLaunch(const BMessage* refs, bool async, bool openWithOK)
|
||||
{
|
||||
if (!async)
|
||||
_TrackerLaunchDocuments(0, refs, openWithOK);
|
||||
_TrackerLaunchDocuments(NULL, refs, openWithOK);
|
||||
else
|
||||
AsynchLaunchBinder(&_TrackerLaunchDocuments, 0, refs, openWithOK);
|
||||
AsynchLaunchBinder(&_TrackerLaunchDocuments, NULL, refs, openWithOK);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -3787,22 +3790,22 @@ FSLaunchUsing(const entry_ref* ref, BMessage* listOfRefs)
|
||||
|
||||
|
||||
status_t
|
||||
FSLaunchItem(const entry_ref* ref, BMessage* message, int32, bool async)
|
||||
FSLaunchItem(const entry_ref* appRef, BMessage* refs, int32, bool async)
|
||||
{
|
||||
if (message != NULL)
|
||||
message->what = B_REFS_RECEIVED;
|
||||
if (refs != NULL)
|
||||
refs->what = B_REFS_RECEIVED;
|
||||
|
||||
status_t result = TrackerLaunch(ref, message, async, true);
|
||||
delete message;
|
||||
status_t result = TrackerLaunch(appRef, refs, async, true);
|
||||
delete refs;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FSLaunchItem(const entry_ref* ref, BMessage* message, int32 workspace)
|
||||
FSLaunchItem(const entry_ref* appRef, BMessage* refs, int32 workspace)
|
||||
{
|
||||
FSLaunchItem(ref, message, workspace, true);
|
||||
FSLaunchItem(appRef, refs, workspace, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,11 +244,11 @@ status_t FSGetParentVirtualDirectoryAware(const BEntry& entry, entry_ref& _ref);
|
||||
status_t FSGetParentVirtualDirectoryAware(const BEntry& entry, BEntry& _entry);
|
||||
status_t FSGetParentVirtualDirectoryAware(const BEntry& entry, BNode& _node);
|
||||
|
||||
status_t TrackerLaunch(const entry_ref* app, bool async);
|
||||
status_t TrackerLaunch(const entry_ref* appRef, bool async);
|
||||
status_t TrackerLaunch(const BMessage* refs, bool async,
|
||||
bool okToRunOpenWith = true);
|
||||
status_t TrackerLaunch(const entry_ref* app, const BMessage* refs, bool async,
|
||||
bool okToRunOpenWith = true);
|
||||
status_t TrackerLaunch(const entry_ref* appRef, const BMessage* refs,
|
||||
bool async, bool okToRunOpenWith = true);
|
||||
status_t LaunchBrokenLink(const char*, const BMessage*);
|
||||
|
||||
status_t FSFindTrackerSettingsDir(BPath*, bool autoCreate = true);
|
||||
@ -266,10 +266,10 @@ bool ConfirmChangeIfWellKnownDirectory(const BEntry* entry,
|
||||
bool CheckDevicesEqual(const entry_ref* entry, const Model* targetModel);
|
||||
|
||||
// Deprecated calls use newer calls above instead
|
||||
_IMPEXP_TRACKER void FSLaunchItem(const entry_ref*, BMessage* = NULL,
|
||||
int32 workspace = -1);
|
||||
_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref*, BMessage*,
|
||||
int32 workspace, bool asynch);
|
||||
_IMPEXP_TRACKER void FSLaunchItem(const entry_ref* appRef,
|
||||
BMessage* refs = NULL, int32 workspace = -1);
|
||||
_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref* appRef,
|
||||
BMessage* refs, int32 workspace, bool asynch);
|
||||
_IMPEXP_TRACKER void FSOpenWithDocuments(const entry_ref* executableToLaunch,
|
||||
BMessage* documentEntryRefs);
|
||||
_IMPEXP_TRACKER status_t FSLaunchUsing(const entry_ref* ref,
|
||||
|
Loading…
x
Reference in New Issue
Block a user