瀏覽代碼

[Pal/Linux-SGX] load_trusted_file(): fix uninitialized pointer

Previously, *stubptr was not initialized to NULL in the corner case of a
file created from inside of the SGX enclave. This led to a subsequent
failure in logic which tried to mmap an empty file (because it observed
that *stubptr contained some value).
Dmitrii Kuvaiskii 6 年之前
父節點
當前提交
822b5a4475
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      Pal/src/host/Linux-SGX/enclave_framework.c

+ 1 - 0
Pal/src/host/Linux-SGX/enclave_framework.c

@@ -274,6 +274,7 @@ int load_trusted_file (PAL_HANDLE file, sgx_stub_t ** stubptr,
        The created file is added to allowed_file list for later access */
     if (create && allow_file_creation) {
        register_trusted_file(uri, NULL);
+       *stubptr = NULL;
        *sizeptr = 0;
        return 0;
     }