Fix the buffer overflow issue when reading socket data 37/283237/2
authorRichard <r.huang@samsung.com>
Thu, 20 Oct 2022 15:43:28 +0000 (16:43 +0100)
committerRichard <r.huang@samsung.com>
Thu, 20 Oct 2022 16:04:40 +0000 (17:04 +0100)
Change-Id: I026d7ec67f16451d6bf43ca5062d59cbe2ea5150

dali/internal/network/common/network-performance-server.cpp

index 804ad6a..d81e456 100644 (file)
@@ -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);
       }