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

Insufficient buffer size in C++ code causing debug builds to crash #3246

Open
eXl5eQ opened this issue May 10, 2024 · 1 comment
Open

Insufficient buffer size in C++ code causing debug builds to crash #3246

eXl5eQ opened this issue May 10, 2024 · 1 comment

Comments

@eXl5eQ
Copy link

eXl5eQ commented May 10, 2024

Here in aedevice.cpp

	char subkey[14];
	wsprintfA(subkey, "\\DosDevices\\%C:", driveLetter);

It's writing a 14-chars-long string "\DosDevices\X:" into a 14-chars-long buffer. However, wsprintfA appends a termincating null character to the string, so the buffer actually needs a capacity of at least 15 chars, otherwise it's a buffer overflow at runtime.

To be honest, it's not likely that it will cause any problem in real world. But an address sanitizer, which I often enabled in debug builds, will catch such out-of-bound access and crash the program.

@parg
Copy link
Contributor

parg commented May 11, 2024

Thanks for reporting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants