From 37ee05f7c0f1fa8d94317e92795016e91f1bdfa6 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Wed, 3 Oct 2018 01:47:32 -0400
Subject: [PATCH] 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.
---
 src/core/file_sys/submission_package.cpp | 2 --
 src/core/file_sys/submission_package.h   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp
index 5ebae15036..d39b79eddf 100644
--- a/src/core/file_sys/submission_package.cpp
+++ b/src/core/file_sys/submission_package.cpp
@@ -61,8 +61,6 @@ NSP::NSP(VirtualFile file_)
         return;
     }
 
-    extracted = false;
-
     SetTicketKeys(files);
     ReadNCAs(files);
 }
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h
index 2978215221..da3dc5e9f3 100644
--- a/src/core/file_sys/submission_package.h
+++ b/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;