浏览代码

submission_package: Ensure the 'extracted' member variable is always initialized

If an error occurs when constructing the PartitionFilesystem instance,
the constructor would be exited early, which wouldn't initialize the
extracted data member, making it possible for other code to perform an
uninitialized read by calling the public IsExtractedType() member
function. This prevents that.
Lioncash 7 年之前
父节点
当前提交
37ee05f7c0
共有 2 个文件被更改,包括 1 次插入3 次删除
  1. 0 2
      src/core/file_sys/submission_package.cpp
  2. 1 1
      src/core/file_sys/submission_package.h

+ 0 - 2
src/core/file_sys/submission_package.cpp

@@ -61,8 +61,6 @@ NSP::NSP(VirtualFile file_)
         return;
     }
 
-    extracted = false;
-
     SetTicketKeys(files);
     ReadNCAs(files);
 }

+ 1 - 1
src/core/file_sys/submission_package.h

@@ -64,7 +64,7 @@ private:
 
     VirtualFile file;
 
-    bool extracted;
+    bool extracted = false;
     Loader::ResultStatus status;
     std::map<u64, Loader::ResultStatus> program_status;