Fix Security Static Code Analysis 61/30561/2
authorGu Chaojie <chao.jie.gu@intel.com>
Sat, 22 Nov 2014 01:12:51 +0000 (09:12 +0800)
committerGu Chaojie <chao.jie.gu@intel.com>
Sat, 22 Nov 2014 01:12:51 +0000 (09:12 +0800)
Bug-Tizen: TC-2072

Change-Id: I7e92d05aca928992f185e402d6b3fffd0419584c
Signed-off-by: Gu Chaojie <chao.jie.gu@intel.com>
obexd/plugins/pbap.c
profiles/network/server.c
src/device.c
tools/hciattach.c
tools/hcitool.c

index 79e85ab..c3b79d5 100644 (file)
@@ -756,7 +756,7 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,
 {
        struct pbap_session *pbap = context;
        struct pbap_object *obj = NULL;
-       int ret;
+       int ret = 0;
        void *request;
 
        DBG("name %s context %p valid %d", name, context, pbap->cache.valid);
@@ -810,7 +810,7 @@ static void *vobject_vcard_open(const char *name, int oflag, mode_t mode,
        struct pbap_session *pbap = context;
        const char *id;
        uint32_t handle;
-       int ret;
+       int ret = 0;
        void *request;
 
        DBG("name %s context %p valid %d", name, context, pbap->cache.valid);
index a1c5646..dfd63b2 100644 (file)
@@ -344,7 +344,7 @@ static gboolean bnep_setup(GIOChannel *chan,
                        GIOCondition cond, gpointer user_data)
 {
        struct network_adapter *na = user_data;
-       struct network_server *ns;
+       struct network_server *ns = NULL;
        struct network_session *session;
        uint8_t packet[BNEP_MTU];
        struct bnep_setup_conn_req *req = (void *) packet;
index a4b5e93..d55b9cd 100644 (file)
@@ -274,7 +274,7 @@ static GSList *find_service_with_state(GSList *list,
 
 static void update_technologies(GKeyFile *file, struct btd_device *dev)
 {
-       const char *list[2];
+       const char *list[2] = {NULL, NULL};
        size_t len = 0;
 
        if (dev->bredr)
index c213fe4..424748b 100644 (file)
@@ -1464,7 +1464,7 @@ int main(int argc, char *argv[])
                        dev[0] = 0;
                        if (!strchr(opt, '/'))
                                strcpy(dev, "/dev/");
-                       strcat(dev, opt);
+                       strncat(dev, opt, PATH_MAX);
                        break;
 
                case 1:
index e1effc4..59102f9 100644 (file)
@@ -2385,7 +2385,8 @@ failed:
 
 static int print_advertising_devices(int dd, uint8_t filter_type)
 {
-       unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr;
+       unsigned char buf[HCI_MAX_EVENT_SIZE] = {0};
+       unsigned char *ptr;
        struct hci_filter nf, of;
        struct sigaction sa;
        socklen_t olen;