Skip to content

Commit

Permalink
Fix crash when mounting floppy image with no extension
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Oct 10, 2023
1 parent cdcfb55 commit e1bd97d
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/dos/dos_programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5169,21 +5169,23 @@ class IMGMOUNT : public Program {
}
if (!rtype&&!rfstype&&fstype!="none"&&paths[0].length()>4) {
const char *ext = strrchr(paths[0].c_str(), '.');
if (!strcasecmp(ext, ".iso")||!strcasecmp(ext, ".cue")||!strcasecmp(ext, ".bin")||!strcasecmp(ext, ".chd")||!strcasecmp(ext, ".mdf")||!strcasecmp(ext, ".gog")||!strcasecmp(ext, ".ins")) {
type="iso";
fstype="iso";
if(ide_index < 0 || ideattach == "auto") {
if(!IDE_controller_occupied(1, false)) { // check if secondary master is already occupied
ide_index = 1;
ide_slave = false;
}
else IDE_Auto(ide_index, ide_slave);
LOG_MSG("IDE: index %d slave=%d", ide_index, ide_slave ? 1 : 0);
}
} else if (!strcasecmp(ext, ".ima")) {
type="floppy";
ideattach="none";
}
if (ext != NULL) {
if (!strcasecmp(ext, ".iso")||!strcasecmp(ext, ".cue")||!strcasecmp(ext, ".bin")||!strcasecmp(ext, ".chd")||!strcasecmp(ext, ".mdf")||!strcasecmp(ext, ".gog")||!strcasecmp(ext, ".ins")) {
type="iso";
fstype="iso";
if(ide_index < 0 || ideattach == "auto") {
if(!IDE_controller_occupied(1, false)) { // check if secondary master is already occupied
ide_index = 1;
ide_slave = false;
}
else IDE_Auto(ide_index, ide_slave);
LOG_MSG("IDE: index %d slave=%d", ide_index, ide_slave ? 1 : 0);
}
} else if (!strcasecmp(ext, ".ima")) {
type="floppy";
ideattach="none";
}
}
}
}

Expand Down

0 comments on commit e1bd97d

Please sign in to comment.