From 9ac01875fb992b90d45430ecec815220f8c5b83a Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 8 Jan 2023 13:47:56 -0800 Subject: [PATCH] fix potential uninitialized memory access --- CMakeLists.txt | 2 +- src/Text.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2030c5d5..c073d4c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ list(APPEND CMAKE_PREFIX_PATH ${LOCAL_LIB_DIR}) include_directories(${LOCAL_INCLUDE_DIR}) link_directories(${LOCAL_LIB_DIR}) -set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_BUILD_TYPE Release) diff --git a/src/Text.hh b/src/Text.hh index 779bfeae..2c24fc98 100644 --- a/src/Text.hh +++ b/src/Text.hh @@ -56,7 +56,7 @@ size_t text_strlen_t(const T* s) { template size_t text_strnlen_t(const T* s, size_t count) { size_t ret = 0; - for (; s[ret] != 0 && ret < count; ret++) { } + for (; (ret < count) && (s[ret] != 0); ret++) { } return ret; }