mirror of
https://github.com/cathery/sys-con.git
synced 2024-12-28 18:17:13 +00:00
Clear the interfaces array before passing it to usbhs to avoid bad input
This commit is contained in:
parent
2042d65935
commit
50b0a158ce
@ -8,6 +8,7 @@
|
||||
#include "SwitchUSBDevice.h"
|
||||
#include "ControllerHelpers.h"
|
||||
#include "log.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace syscon::usb
|
||||
{
|
||||
@ -120,6 +121,7 @@ namespace syscon::usb
|
||||
|
||||
std::scoped_lock usbLock(usbMutex);
|
||||
eventClear(usbHsGetInterfaceStateChangeEvent());
|
||||
memset(interfaces, 0, sizeof(interfaces));
|
||||
if (R_SUCCEEDED(usbHsQueryAcquiredInterfaces(interfaces, sizeof(interfaces), &total_entries)))
|
||||
{
|
||||
for (auto it = controllers::Get().begin(); it != controllers::Get().end(); ++it)
|
||||
@ -161,6 +163,7 @@ namespace syscon::usb
|
||||
.bInterfaceProtocol = iprotocol,
|
||||
};
|
||||
s32 out_entries = 0;
|
||||
memset(interfaces, 0, sizeof(interfaces));
|
||||
usbHsQueryAvailableInterfaces(&filter, interfaces, sizeof(interfaces), &out_entries);
|
||||
return out_entries;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user