Fix svace issues
authorJiwan Kim <ji-wan.kim@samsung.com>
Tue, 13 Jun 2017 07:22:55 +0000 (16:22 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:09:10 +0000 (11:09 +0900)
src/mesh.c
src/mesh_dbus.c
test/menu.c

index 3c43dbc238de6a9005e342252be7d1b57eaa6fa9..bade637a9fbdddb8ea68b6dd9f98de735a12e458 100644 (file)
@@ -70,7 +70,7 @@ EXPORT_API int mesh_network_clone(mesh_network_h* dst, mesh_network_h src)
        net->rssi = _src->rssi;
        net->data_rate = _src->data_rate;
        net->security = _src->security;
-       if (_src->passphrase)
+       if (strlen(_src->passphrase) > 0)
                snprintf(net->passphrase, MAX_PASSPHRASE_LEN, "%s", _src->passphrase);
 
        *dst = (mesh_network_h)net;
index 838ecd48b4a27cade3ade0df99cd0548065ef015..7e3bdd9503f5811c0100d6140be968ddbf47c6c6 100644 (file)
@@ -76,11 +76,15 @@ static void _dbus_name_owner_notify(GObject *object, GParamSpec *pspec,
        gchar *name_owner = g_dbus_proxy_get_name_owner(proxy);
        mesh_h handle = (mesh_h)user_data;
 
+       LOGD("Name owner notify [%s]", name_owner);
+
        if (name_owner)
                return;
 
-       LOGE("name_owner is not exists !");
-       _mesh_close_gdbus_call(handle);
+       if (NULL == name_owner)
+               _mesh_close_gdbus_call(handle);
+
+       g_free(name_owner);
 }
 
 static int _mesh_create_gdbus_call(mesh_h handle)
index 7dfab330e36b17d8f23779914b0fb3abfded0028..e3a38d37a02a9faf99aa9265b6896b60a3758185 100644 (file)
@@ -349,7 +349,7 @@ static void _hex_dump(const char *pad, int size, const void *data)
        snprintf(buf, 255, "%s%04X: ", pad, 0);
        for (i = 0; i < size; i++) {
                snprintf(hex, 4, "%02X ", p[i]);
-               strncat(buf, hex, strlen(hex));
+               strncat(buf, hex, 255 - strlen(buf) - 1);
 
                if ((i + 1) % 8 == 0) {
                        if ((i + 1) % 16 == 0) {
@@ -357,7 +357,7 @@ static void _hex_dump(const char *pad, int size, const void *data)
                                memset(buf, 0, 255);
                                snprintf(buf, 255, "%s%04X: ", pad, i + 1);
                        } else {
-                               strncat(buf, TAB_SPACE, strlen(TAB_SPACE));
+                               strncat(buf, TAB_SPACE, 255 - strlen(buf) - 1);
                        }
                }
        }