Skip to content

Commit

Permalink
Double oops, actually fixed this time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Genwald committed Nov 18, 2019
1 parent 24df5cc commit 2caec94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/mod_installer.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ int load_mod(const char* path, long offset, FILE* arc) {
if(pathStr.find(backups_root) == std::string::npos) {
const char* modNameStart = path+strlen(mods_root);
u32 modNameSize = (u32)(strchr(modNameStart, '/') - modNameStart);
char* modName = new char[modNameSize];
char* modName = new char[modNameSize+1];
strncpy(modName, modNameStart, modNameSize);
modName[modNameSize-1] = 0;
modName[modNameSize] = 0;
if(compSize > 0)
backup(modName, compSize, offset, arc);
else
Expand Down Expand Up @@ -373,9 +373,9 @@ void load_mods(FILE* f_arc) {
else {
const char* modNameStart = mod_path_c_str+strlen(mods_root);
u32 modNameSize = (u32)(strchr(modNameStart, '/') - modNameStart);
char* modName = new char[modNameSize];
char* modName = new char[modNameSize+1];
strncpy(modName, modNameStart, modNameSize);
modName[modNameSize-1] = 0;
modName[modNameSize] = 0;
int fileNameSize = snprintf(nullptr, 0, "%s%s/0x%lx.backup", backups_root, modName, offset) + 1;
char* backup_path = new char[fileNameSize];
snprintf(backup_path, fileNameSize, "%s%s/0x%lx.backup", backups_root, modName, offset);
Expand Down

0 comments on commit 2caec94

Please sign in to comment.