Fix null pointer dereference and memory-illegal access problems
authorTaeyoung Kim <ty317.kim@samsung.com>
Wed, 3 Apr 2013 01:44:05 +0000 (10:44 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Wed, 3 Apr 2013 01:49:19 +0000 (10:49 +0900)
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
Change-Id: I762bb72a04aaaa37e2b3cfde8acfc7d29b0420b8

usb-popup/src/usb-syspopup.c
usbotg-popup/src/usbotg-syspopup.c

index 1ba6682..529a220 100644 (file)
@@ -745,6 +745,7 @@ static void load_select_pkg_for_acc_popup(struct appdata *ad)
        if (0 > ret) {
                USB_LOG("FAIL: get_accessory_info(ad)");
                elm_exit();
+               return ;
        }
 
        numOfApps = get_accessory_matched(ad);
@@ -789,6 +790,7 @@ static void load_select_pkg_for_host_popup(struct appdata *ad)
        if (0 > ret) {
                USB_LOG("FAIL: get_host_info(ad)");
                elm_exit();
+               return ;
        }
 
        numOfApps = get_host_matched(ad);
@@ -856,6 +858,7 @@ static int __app_reset(bundle *b, void *data)
        if (!type) {
                USB_LOG("ERROR: Non existing type of popup\n");
                elm_exit();
+               return -1;
        }
 
        ad->type = atoi(type);
@@ -879,7 +882,7 @@ static int __app_reset(bundle *b, void *data)
                USB_LOG("ERROR: The popup type(%d) does not exist\n", ad->type);
                ad->isClientOrHost = USB_DEVICE_UNKNOWN;
                elm_exit();
-               break;
+               return -1;
        }
 
        switch(ad->type) {
index e0106ee..6a9031d 100755 (executable)
@@ -54,7 +54,7 @@ static int ipc_socket_client_init()
                return -1;;
        }
        remote.sun_family = AF_UNIX;
-       strncpy(remote.sun_path, SOCK_PATH, sizeof(remote.sun_family));
+       strncpy(remote.sun_path, SOCK_PATH, strlen(SOCK_PATH) + 1 );
        if (connect(sockFd, (struct sockaddr *)&remote, sizeof(remote)) == -1) {
                USB_LOG("FAIL: connect()");
                close(sockFd);