@@ -335,13 +335,15 @@ void backupSavedata(Title* title, u8 slot, bool allusers, bool common) {
335335 if (!allusers && !isWii ) {
336336 char usrPath [16 ];
337337 getUserID (usrPath );
338- sprintf ( dstPath + strlen (dstPath ), "/%s" , usrPath );
339- u32 offset = strlen (srcPath );
338+ u32 srcOffset = strlen (srcPath );
339+ u32 dstOffset = strlen (dstPath );
340340 if (common ) {
341- strcpy (srcPath + offset , "/common" );
341+ strcpy (srcPath + srcOffset , "/common" );
342+ strcpy (dstPath + dstOffset , "/common" );
342343 if (DumpDir (srcPath , dstPath )!= 0 ) promptError ("Common save not found." );
343344 }
344- sprintf (srcPath + offset , "/%s" , usrPath );
345+ sprintf (srcPath + srcOffset , "/%s" , usrPath );
346+ sprintf (dstPath + dstOffset , "/%s" , usrPath );
345347 }
346348 if (DumpDir (srcPath , dstPath )!= 0 ) promptError ("Backup failed. DO NOT restore from this slot." );
347349
@@ -366,13 +368,15 @@ void restoreSavedata(Title* title, u8 slot, bool allusers, bool common) {
366368 if (!allusers && !isWii ) {
367369 char usrPath [16 ];
368370 getUserID (usrPath );
369- sprintf ( dstPath + strlen (dstPath ), "/%s" , usrPath );
370- u32 offset = strlen (srcPath );
371+ u32 srcOffset = strlen (srcPath );
372+ u32 dstOffset = strlen (dstPath );
371373 if (common ) {
372- strcpy (srcPath + offset , "/common" );
374+ strcpy (srcPath + srcOffset , "/common" );
375+ strcpy (dstPath + dstOffset , "/common" );
373376 if (DumpDir (srcPath , dstPath )!= 0 ) promptError ("Common save not found." );
374377 }
375- sprintf (srcPath + offset , "/%s" , usrPath );
378+ sprintf (srcPath + srcOffset , "/%s" , usrPath );
379+ sprintf (dstPath + dstOffset , "/%s" , usrPath );
376380 }
377381 if (DumpDir (srcPath , dstPath )!= 0 ) promptError ("Restore failed." );
378382
0 commit comments