tzip: fix string compare bug 35/90435/1 accepted/tizen/ivi/20160930.232941 accepted/tizen/mobile/20160930.232854 accepted/tizen/tv/20160930.232910 accepted/tizen/wearable/20160930.232922 submit/tizen/20160930.050513
authortaeyoung <ty317.kim@samsung.com>
Fri, 30 Sep 2016 04:57:33 +0000 (13:57 +0900)
committertaeyoung <ty317.kim@samsung.com>
Fri, 30 Sep 2016 04:57:33 +0000 (13:57 +0900)
- tzip checks if the mountpath is on TZ_SYS_HOME or TZ_SYS_RW_APP.
  Thus the length of the comparation needs to be from TZ_SYS_HOME
  or TZ_SYS_RW_APP, not the mountpath.

Change-Id: I8ace95651d6101ad1cf7ab85526ee03a4ebb966b
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/tzip/tzip.c

index d165404..dcbe6c0 100644 (file)
@@ -86,17 +86,17 @@ static int check_smack_label(pid_t pid)
 
 static int check_path_available(char *mountpath)
 {
-       size_t len;
+       const char *path;
 
        if (!mountpath)
                return 0;
 
-       len = strlen(mountpath);
-
-       if (!strncmp(mountpath, tzplatform_getenv(TZ_SYS_HOME), len))
+       path = tzplatform_getenv(TZ_SYS_HOME);
+       if (!strncmp(mountpath, path, strlen(path)))
                return 1;
 
-       if (!strncmp(mountpath, tzplatform_getenv(TZ_SYS_RW_APP), len))
+       path = tzplatform_getenv(TZ_SYS_RW_APP);
+       if (!strncmp(mountpath, path, strlen(path)))
                return 1;
 
        return 0;