hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

Add a bunch of sanity checks

Open Megamouse opened this issue 1 year ago • 3 comments

Some of these changes are meant to fix a couple of warnings while reading the code. I also noticed that there were almost no sanity checks in the code, which may lead to lots of segfaults in user code.

  • Win: Do not call CloseHandle in hid_open_path if device_handle is null
  • Win: return errors if malloc calls fail
  • Add missing NULL checks to many parameters

Megamouse avatar Sep 25 '24 20:09 Megamouse

I think I made all the necessary changes.

Megamouse avatar Sep 26 '24 19:09 Megamouse

NOTE: in #698 I've added some of those

Youw avatar Oct 01 '24 07:10 Youw

If you tell me what to keep and what to remove I can adjust this soon

Megamouse avatar Oct 04 '24 20:10 Megamouse

I guess I had too many comments/questions to this PR. Instead I prepared #727 based on this, with all my comments applied.

Youw avatar Mar 11 '25 20:03 Youw