Browse Source

[Pal/Linux-SGX] Check value of sgx.allow_file_creation, not only its existence

Previously, if `sgx.allow_file_creation = 0` was specified in the manifest,
it was incorrectly processed as `sgx.allow_file_creation = 1` (the code
only checked this key's existence but never checked the value itself).
Jia Zhang 6 years ago
parent
commit
788c61fc22
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Pal/src/host/Linux-SGX/enclave_framework.c

+ 3 - 3
Pal/src/host/Linux-SGX/enclave_framework.c

@@ -892,10 +892,10 @@ no_trusted:
 no_allowed:
     ret = 0;
 
-    if (get_config(store, "sgx.allow_file_creation", cfgbuf, cfgsize) <= 0) {
-        allow_file_creation = false;
-    } else
+    if (get_config(store, "sgx.allow_file_creation", cfgbuf, cfgsize) > 0 && cfgbuf[0] == '1')
         allow_file_creation = true;
+    else
+        allow_file_creation = false;
 
 out:
     free(cfgbuf);