Skip to content

Potential buffer overflow #1773

Closed
Closed
@mbektchiev

Description

@mbektchiev

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
This call to GetModuleFilenameW specifies an incorrect buffer size and can result in a buffer overflow.

According to the docs the nSize parameter should be the number of characters and not bytes that the buffer can take. This means that the system function will start truncating the returned path only if it were longer than twice the buffer size.

SDK version number
latest main branch

Platform/OS/Hardware/Device
Windows

To Reproduce (observed behavior)
N/A

Expected behavior
N/A

Logs/output
N/A

Additional context
Reported by a static Veracode scan.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions