Files
openairinterface5g/common/config/tests/CMakeLists.txt
Bartosz Podrygajlo b0ff7c089e fix(config): fix memory safety, memory leaks, and add unit test coverage
- Fix an out-of-bounds/segmentation fault in `config_getlist` when parsing
  command-line options that do not specify bracket offsets (e.g.
  `--rfsimulator.serveraddr`). Added index bracket verification and guarded
  `memcpy` against `NULL` pointers on list reallocation.
- Initialize `valid_idx` to `ParamList->numelt` in `config_getlist` to
  properly support overriding and appending elements when a configuration
  file has existing array items.
- Fix memory leaks in  `end_configmodule`
- Add  test cases in `test_config_cmdline.cpp`

Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org> and assisted-by Gemini
2026-05-27 11:35:15 +02:00

12 lines
511 B
CMake

# SPDX-License-Identifier: LicenseRef-CSSL-1.0
add_executable(test_config_cmdline test_config_cmdline.cpp)
target_link_libraries(test_config_cmdline PRIVATE CONFIG_LIB GTest::gtest)
add_dependencies(test_config_cmdline params_libconfig)
add_dependencies(tests test_config_cmdline)
configure_file(test_config.conf test_config.conf COPYONLY)
add_test(NAME test_config_cmdline COMMAND ./test_config_cmdline)
set_tests_properties(test_config_cmdline PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}")