Describe the bug
In src/packages/buskill/__init__.py, the hotplugCallbackWin function (Windows USB hotplug handler) calls DEV_BROADCAST_HDR.from_address(lparam) without first validating that lparam is a valid pointer. Some WM_DEVICECHANGE subtypes (e.g., DBT_CONFIGCHANGED) pass NULL for lparam, which would cause from_address(0) to access invalid memory and crash the process.
Code reference
src/packages/buskill/__init__.py:175:
dev_broadcast_hdr = DEV_BROADCAST_HDR.from_address(lparam)
The wparam check at line 169 only validates that the event is DBT_DEVICEREMOVECOMPLETE, but does not ensure lparam is non-null before dereferencing.
Expected behavior
Add a null check on lparam before calling from_address:
if lparam == 0:
return True
dev_broadcast_hdr = DEV_BROADCAST_HDR.from_address(lparam)
Steps to reproduce
- Run BusKill on Windows
- Trigger a system-level
WM_DEVICECHANGE event that is not device-specific (e.g., changing power source, docking station events)
- Process crashes
Severity
High — null pointer dereference causing crash on Windows systems.
Describe the bug
In
src/packages/buskill/__init__.py, thehotplugCallbackWinfunction (Windows USB hotplug handler) callsDEV_BROADCAST_HDR.from_address(lparam)without first validating thatlparamis a valid pointer. SomeWM_DEVICECHANGEsubtypes (e.g.,DBT_CONFIGCHANGED) passNULLforlparam, which would causefrom_address(0)to access invalid memory and crash the process.Code reference
src/packages/buskill/__init__.py:175:The
wparamcheck at line 169 only validates that the event isDBT_DEVICEREMOVECOMPLETE, but does not ensurelparamis non-null before dereferencing.Expected behavior
Add a null check on
lparambefore callingfrom_address:Steps to reproduce
WM_DEVICECHANGEevent that is not device-specific (e.g., changing power source, docking station events)Severity
High — null pointer dereference causing crash on Windows systems.