Skip to content

Commit

Permalink
libusb/serialInterface: Fixed a potential nullptr dereference issues …
Browse files Browse the repository at this point in the history
…in the constructor
  • Loading branch information
dragonmux committed Dec 10, 2023
1 parent fc06643 commit 50ed8fb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libusb/serialInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ serialInterface_t::serialInterface_t(const usbDevice_t &usbDevice) : device{usbD
for (const auto epIndex : substrate::indexSequence_t{2U})
{
const auto endpoint{firstAltMode.endpoint(epIndex)};
if (!endpoint.valid())
{
console.error("Probe interface missing a requireed endpoint (index "sv, epIndex, ')');
return;
}
if (endpoint.direction() == endpointDir_t::controllerOut)
txEndpoint = endpoint.address();
else
Expand Down

0 comments on commit 50ed8fb

Please sign in to comment.