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 buffer overflow in GetRawInputDeviceInfo proxy #4268

Merged

Commits on Sep 27, 2024

  1. Fix buffer overflow in GetRawInputDeviceInfo proxy

    The proxy for GetRawInputDeviceInfo() incorrectly assumes that pcbSize
    is always in wchars when unicode is used, which is only true if the
    name of the device is being queried (`uiCommand == RIDI_DEVICENAME`).
    
    Otherwise, it is the exact size of the buffer in bytes. Right now,
    that means that the proxy will write double the number of bytes it's
    supposed to for the other `uiCommand` values, potentially causing a
    buffer overflow.
    
    Also, when no `pData` value is given, `*pcbSize` is allowed to be
    uninitialized. The proxy currently reads it unconditionally as a UINT,
    which would be UB in that case. `memcpy` is able to safely copy
    uninitialized values, so let's use that instead!
    marti4d committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    f20fc93 View commit details
    Browse the repository at this point in the history