Open source Vulnerability fixed 22/191122/1
authorRahul Dadhich <r.dadhich@samsung.com>
Fri, 5 Oct 2018 10:56:50 +0000 (16:26 +0530)
committerRahul Dadhich <r.dadhich@samsung.com>
Thu, 11 Oct 2018 11:43:11 +0000 (11:43 +0000)
Change-Id: I0a8b15c76ff603044b8bc50005bcc6ac27143d26
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
hw/9pfs/9p-local.c

index 845675e7a1bb23b1c7b6682a82fcb575a345e21b..8131aacdd0e5165a9b087feca9d944d764cbf8df 100644 (file)
@@ -1061,8 +1061,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
 {
     if (dir_path) {
         v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
-    } else {
+    } else if (strcmp(name, "/")) {
         v9fs_path_sprintf(target, "%s", name);
+    } else {
+        /* We want the path of the export root to be relative, otherwise
+         * "*at()" syscalls would treat it as "/" in the host.
+         */
+        v9fs_path_sprintf(target, "%s", ".");
     }
     return 0;
 }