Ver código fonte

[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 anos atrás
pai
commit
822b5a4475
1 arquivos alterados com 1 adições e 0 exclusões
  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;
     }