This patch adds the `strnlen_s` function from Annex K. In order to reduce duplication between `strnlen` and `strnlen_s`, the common logic has been extracted to a new internal function which both now call. In addition to the function definition, the patch adds a unit test and a fuzzing test.
59 lines
796 B
CMake
59 lines
796 B
CMake
add_libc_fuzzer(
|
|
strcmp_fuzz
|
|
SRCS
|
|
strcmp_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.strcmp
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
strcpy_fuzz
|
|
SRCS
|
|
strcpy_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.memcpy
|
|
libc.src.string.strcpy
|
|
libc.src.string.strlen
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
strstr_fuzz
|
|
SRCS
|
|
strstr_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.strstr
|
|
libc.src.string.strlen
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
memcmp_fuzz
|
|
SRCS
|
|
memcmp_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.memcmp
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
bcmp_fuzz
|
|
SRCS
|
|
bcmp_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.strings.bcmp
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
strlen_fuzz
|
|
SRCS
|
|
strlen_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.strlen
|
|
)
|
|
|
|
add_libc_fuzzer(
|
|
strnlen_s_differential_fuzz
|
|
SRCS
|
|
strnlen_s_differential_fuzz.cpp
|
|
DEPENDS
|
|
libc.src.string.strnlen_s
|
|
)
|