From 22bc976c19e616a61fc663583e5a5b9920ccd785 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 20 Oct 2022 16:43:28 +0100 Subject: [PATCH] Fix the buffer overflow issue when reading socket data Change-Id: I026d7ec67f16451d6bf43ca5062d59cbe2ea5150 --- dali/internal/network/common/network-performance-server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/internal/network/common/network-performance-server.cpp b/dali/internal/network/common/network-performance-server.cpp index 804ad6a..d81e456 100644 --- a/dali/internal/network/common/network-performance-server.cpp +++ b/dali/internal/network/common/network-performance-server.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,7 +164,7 @@ void NetworkPerformanceServer::ClientThread(NetworkPerformanceClient* client) unsigned int bytesRead; bool ok = socket.Read(buffer, sizeof(buffer), bytesRead); - if(ok && (bytesRead > 0)) + if(ok && (bytesRead > 0) && (bytesRead <= SOCKET_READ_BUFFER_SIZE)) { client->ProcessCommand(buffer, bytesRead); } -- 2.7.4