mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
cmHexFileConverter: Avoid stack buffer overflow
Prevent overflow on maliciously-crafted Motorola S1 record files which have a maximum line length over the 256-byte maximum.
This commit is contained in:
@@ -55,6 +55,10 @@ else()
|
||||
"file(STRINGS) incorrectly read from srec file [${infile_strings}]")
|
||||
endif()
|
||||
|
||||
# this file is crafted to contain the maximum line length and trigger a buffer
|
||||
# overflow
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/s1-max-length.srec" infile_strings)
|
||||
|
||||
#this file has utf-8 content
|
||||
file(STRINGS test.utf8 infile_strings ENCODING UTF-8)
|
||||
list(LENGTH infile_strings content_len)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
S107000001020304EE
|
||||
S1FF000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414100
|
||||
Reference in New Issue
Block a user