]> git.ipfire.org Git - thirdparty/glibc.git/commit
Fix malloc/tst-scratch_buffer OOB access
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 11 Oct 2022 12:23:25 +0000 (13:23 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 27 Oct 2022 13:46:48 +0000 (14:46 +0100)
commit1dc3098e2c316254d6a9cb50797f2eca9be92b9f
tree15f6f6a59d21cafce9b9dbb76908056ad147ad8f
parent5f1f0f9a718b67c6205dbb90760a0f72385dc205
Fix malloc/tst-scratch_buffer OOB access

The test used scratch_buffer_dupfree incorrectly:

- The passed in size must be <= buf.length.
- Must be called at most once on a buf object since it frees it.
- After it is called buf.data and buf.length must not be accessed.

All of these were violated, the test happened to work because the
buffer was on the stack, which meant the test copied out-of-bounds
bytes from the stack into a new buffer and then compared those bytes.

Run one test and avoid the issues above.
malloc/tst-scratch_buffer.c