Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #12 from github/uaf-fix
Browse files Browse the repository at this point in the history
Fix UAF in SoftU2FUserClient::start
  • Loading branch information
mastahyeti authored Jul 25, 2017
2 parents 338d0c9 + 3d793fd commit ac45d5c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SoftU2FDriver/SoftU2FUserClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ bool SoftU2FUserClient::start(IOService *provider) {
if (!device->start(this))
goto fail_device_start;

device->release();

workLoop = getWorkLoop();
if (!workLoop)
goto fail_no_workloop;
Expand All @@ -107,6 +105,10 @@ bool SoftU2FUserClient::start(IOService *provider) {
if (workLoop->addEventSource(_commandGate) != kIOReturnSuccess)
goto fail_add_event_source;

// Our call to device->attach took a retain on the device when it was added to the registry.
// That will be released when the device is detached from the registry.
device->release();

return true;

fail_add_event_source:
Expand Down

0 comments on commit ac45d5c

Please sign in to comment.