From 335cbb3e6bc2e44786e5c3d4775af1d5d72e3f6d Mon Sep 17 00:00:00 2001 From: Michel Promonet Date: Sun, 6 Aug 2023 18:36:57 +0200 Subject: [PATCH] fix warning --- CMakeLists.txt | 2 +- src/HttpServerRequestHandler.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 144e31d2..efccedb7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ target_include_directories(civetweb PUBLIC civetweb/include) # rtmp ? find_package(PkgConfig QUIET) pkg_check_modules(RTMP QUIET librtmp) -MESSAGE("RTMP_FOUND = ${RTMP_FOUND}") +MESSAGE("RTMP_FOUND = ${RTMP_FOUND} RTMP_INCLUDE_DIRS=${RTMP_INCLUDE_DIRS} RTMP_LIBRARIES=${RTMP_LIBRARIES}") if (RTMP_FOUND) add_definitions(-DHAVE_RTMP) target_link_libraries (${CMAKE_PROJECT_NAME} ${RTMP_LIBRARIES}) diff --git a/src/HttpServerRequestHandler.cpp b/src/HttpServerRequestHandler.cpp index 2c7cef0e..de702282 100644 --- a/src/HttpServerRequestHandler.cpp +++ b/src/HttpServerRequestHandler.cpp @@ -201,7 +201,7 @@ class PrometheusHandler : public CivetHandler static std::vector read_proc_stat() { char stat_path[32]; - std::sprintf(stat_path, "/proc/%d/stat", getpid()); + std::snprintf(stat_path, sizeof(stat_path),"/proc/%d/stat", getpid()); std::ifstream file(stat_path); std::string line; std::getline(file, line); @@ -212,7 +212,7 @@ class PrometheusHandler : public CivetHandler static long get_fds_total() { char fd_path[32]; - std::sprintf(fd_path, "/proc/%d/fd", getpid()); + std::snprintf(fd_path, sizeof(fd_path), "/proc/%d/fd", getpid()); long file_total = 0; DIR *dirp = opendir(fd_path);