@@ -55,12 +55,12 @@ MCPError getTitlePath(const uint64_t& titleID, fspath& outPath) {
5555}
5656
5757bool checkEnoughFreeSpace (const MCPInstallTarget& device, const uint64_t & minSpace) {
58- static const std::string deviceToPath[ 2 ] = {" /vol/storage_mlc01" , " /vol/storage_usb01" };
58+ static const std::array<std:: string, 2 > deviceToPath = {" /vol/storage_mlc01" , " /vol/storage_usb01" };
5959 if (device < 0 || device > 1 ) {
6060 ErrorLog::getInstance ().log (" Invalid device for checkEnoughFreeSpace()!" );
6161 return false ;
6262 }
63- const std::string& path = deviceToPath[ device] ; // 0 is TARGET_MLC, 1 is TARGET_USB
63+ const std::string& path = deviceToPath. at ( device) ; // 0 is TARGET_MLC, 1 is TARGET_USB
6464
6565 const FSAClientHandle handle = FSAAddClient (NULL );
6666 if (handle < 0 ) {
@@ -132,7 +132,7 @@ static bool installFreeChannel(const fspath& relPath, const MCPInstallTarget& lo
132132 }
133133
134134 alignas (0x40 ) char installPath[FS_MAX_PATH ]{};
135- const size_t count = path.string ().copy (installPath, sizeof (installPath));
135+ const size_t count = path.string ().copy (installPath, sizeof (installPath) - 1 );
136136 if (count != path.string ().length ()) {
137137 ErrorLog::getInstance ().log (" Could not copy full channel path \" " + relPath.string () + " \" to buffer" );
138138 MCP_Close (mcpHandle);
@@ -175,7 +175,7 @@ static bool installFreeChannel(const fspath& relPath, const MCPInstallTarget& lo
175175 alignas (0x40 ) IOSVec pathInfoVector[1 ]{};
176176
177177 pathInfoVector[0 ].vaddr = installPath;
178- pathInfoVector[0 ].len = FS_MAX_PATH ;
178+ pathInfoVector[0 ].len = sizeof (installPath) ;
179179
180180 reinterpret_cast <uint32_t *>(&installInfo)[2 ] = MCP_COMMAND_INSTALL_ASYNC ;
181181 reinterpret_cast <uint32_t *>(&installInfo)[3 ] = reinterpret_cast <uint32_t >(&pathInfoVector[0 ]);
0 commit comments