Pārlūkot izejas kodu

[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 gadi atpakaļ
vecāks
revīzija
822b5a4475
1 mainītis faili ar 1 papildinājumiem un 0 dzēšanām
  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;
     }