summaryrefslogtreecommitdiffstats
path: root/extras/libmemif/src/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2021-01-29 14:18:12 +0000
committerDamjan Marion <dmarion@me.com>2021-02-08 10:27:06 +0000
commite5b7ca4bcea8c404d95e00f5db4c40d47b6e185b (patch)
tree8c63d909d628477c745e0a3455fb5e5ae45e6a48 /extras/libmemif/src/CMakeLists.txt
parent1421748e3cd98d7355b1a1db283803a571569927 (diff)
libmemif: fix insecure uses of strncpy
A calling patterm of "strncpy(dst, src, strlen(src))" invites a lot of troubles. However, even using the target size may result in a problem if the string is longer, since then the termination is not done. Use strlcpy(dst, src, sizeof(dst)), which will always null-terminate the string. Change-Id: I8ddaf3dc8380a78af08914e81849279dae7ab24a Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/libmemif/src/CMakeLists.txt')
-rw-r--r--extras/libmemif/src/CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/extras/libmemif/src/CMakeLists.txt b/extras/libmemif/src/CMakeLists.txt
index aced550ff5d..ddb8a52f82b 100644
--- a/extras/libmemif/src/CMakeLists.txt
+++ b/extras/libmemif/src/CMakeLists.txt
@@ -34,6 +34,13 @@ include_directories(${HEADERS_DIR})
add_library(memif SHARED ${MEMIF_SOURCES})
target_link_libraries(memif ${CMAKE_THREAD_LIBS_INIT})
+
+find_library(LIB_BSD bsd)
+if(LIB_BSD)
+ add_compile_definitions(HAS_LIB_BSD)
+ target_link_libraries(memif ${LIB_BSD})
+endif()
+
foreach(file ${MEMIF_HEADERS})
get_filename_component(dir ${file} DIRECTORY)
install(