Explorar o código

[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 %!s(int64=6) %!d(string=hai) anos
pai
achega
822b5a4475
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  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;
     }