Fix static analysis issue 36/178036/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 8 May 2018 00:19:26 +0000 (09:19 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 8 May 2018 00:19:26 +0000 (09:19 +0900)
- Uses memset() to initialize a buffer

Change-Id: I4a51276c65d8d4075ede631dd4c19c4c16692901
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/fdbroker-internal.cc

index 191143b..20d893c 100644 (file)
@@ -18,6 +18,7 @@
 #define _GNU_SOURCE
 #endif
 
+#include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <aul.h>
@@ -208,9 +209,9 @@ FdBroker::~FdBroker() {
 std::string FdBroker::GetInterfaceName(const std::string& target_appid,
                              const std::string& port_name) {
   std::string interface_name = target_appid + "_" + port_name;
-  char c_buf[interface_name.length() * 2 + 1] = {0};
+  char c_buf[interface_name.length() * 2 + 1];
   char* temp = &c_buf[0];
-
+  memset(c_buf, 0, sizeof(c_buf));
   for (unsigned int index = 0; index < interface_name.length(); index++) {
     snprintf(temp, 3, "%02x", interface_name[index]);
     temp += 2;