Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken HIDPowerDevice_::sendDate method #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Oct 14, 2024

  1. Fix broken HIDPowerDevice_::sendDate method

    The method currently uses a local "bval" variable as argument when calling HID().SendReport(...). This is problematic, since the SendReport method doesn't use "bval" immediately. It instead captures a pointer to "bval" which is accessed when the report is sent at a later point. This leads to a use-after-free situation when the pointer captured by SendReport may no longer point to "bval".
    
    Propose to fix the issue by introducing a new "iManufacturerDate" member in the HIDPowerDevice class to act as persistent storage for the date value.
    forderud committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    e416da5 View commit details
    Browse the repository at this point in the history
  2. Change HIDPowerDevice_::sendDate to send the date as a FEATURE report…

    … instead of a INPUT report, so that it matches the ManufacturerDate parameter in the HID descriptor. This is also required in order for the date to be picked up on Windows.
    forderud committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    9e37c67 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    71c2682 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2024

  1. Change sendDate method to "int sendManufacturerDate(uint16_t year, ui…

    …nt8_t month, uint8_t day)" since it's anyhow tied to the ManufacturerDate parameter.
    forderud committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    fc77679 View commit details
    Browse the repository at this point in the history