wxwidgets/tests/misc
Vadim Zeitlin 72c5691d2f Fix buffer overrun in wxHTMLDataObject under non-MSW platforms
Using strcpy() in GetDataHere() added an extra NUL at the end which
didn't fit into the buffer of the size returned by GetDataSize(). This
could have been also fixed by returning an extra byte from the latter
function, but as the string doesn't need to be NUL-terminated,
apparently, just use memcpy() with the correct number of bytes instead.

Also, because the string is not necessarily NUL-terminated, use the
provided length in wxHTMLDataObject::SetData() instead of relying on the
buffer being NUL-terminated and reading uninitialized memory beyond its
size.

Add a unit test confirming that there are no more ASAN errors when using
this class.

Closes #23660.

Co-Authored-By: mcorino <martin@corino.nl>
2023-06-21 20:38:25 +01:00
..
dynamiclib.cpp Determine location of libc dynamically in wxDynamicLibrary test 2022-08-04 01:07:35 +02:00
environ.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
garbage.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
guifuncs.cpp Fix buffer overrun in wxHTMLDataObject under non-MSW platforms 2023-06-21 20:38:25 +01:00
metatest.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
misctests.cpp Add wxVersionInfo::AtLeast() 2022-12-04 00:44:09 +01:00
module.cpp Replace wxOVERRIDE and wxNOEXCEPT with override and noexcept 2022-10-15 18:10:45 +02:00
pathlist.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
safearrayconverttest.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
selstoretest.cpp Add a unit test exercising the bug fix in the parent commit 2021-01-23 16:40:30 +01:00
settings.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
typeinfotest.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00