From f3527e8aab6885f29760c61bfbee39db682dddcd Mon Sep 17 00:00:00 2001 From: uuz Date: Sun, 15 Sep 2024 14:30:07 +0800 Subject: [PATCH] fix risky functions Signed-off-by: uuz Change-Id: I849927039974b5445ceff04ba013946da6e2529c --- modules/desktop_capture/ohos/base_window_capturer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/desktop_capture/ohos/base_window_capturer.cc b/modules/desktop_capture/ohos/base_window_capturer.cc index 48524b65..b10b6c08 100644 --- a/modules/desktop_capture/ohos/base_window_capturer.cc +++ b/modules/desktop_capture/ohos/base_window_capturer.cc @@ -40,6 +40,7 @@ #include "rtc_base/string_encode.h" #include "rtc_base/string_to_number.h" #include "rtc_base/time_utils.h" +#include "third_party/bounds_checking_function/include/securec.h" namespace webrtc { namespace { @@ -299,7 +300,11 @@ void BaseWindowCapturer::HandleBuffer() { return; } for (int32_t i = 0; i < height; i++) { - memcpy(pData, pSrcData, frameStride); + if (memcpy_s(pData, frameStride, pSrcData, frameStride) != EOK) { + LOG(ERROR) << "data memcpy_s failed"; + screen_capture_adapter_->ReleaseVideoBuffer(); + return; + } pData += frameStride; pSrcData += stride; } -- Gitee