Skip to content

kernelbase: Fixed stack overflow of DefineDosDeviceW()

Wei Xie requested to merge wayne/wine:fix-DefineDosDevice into master
  1. Changed fixed-size buffer to dynamic allocation for link_name to prevent buffer overflow
  2. Added proper memory cleanup with HeapFree in all error paths
  3. Fixed potential null pointer dereference when device is NULL
  4. Improved error handling by checking memory allocation success

The original code used a fixed-size buffer (15 chars) which could overflow with long device names. The new version dynamically allocates memory based on actual device name length, includes proper cleanup, and handles edge cases better.

Signed-off-by: Wei Xie xiewei@uniontech.com

Edited by Wei Xie

Merge request reports

Loading