1
0
Fork 0

Don't crash if dta is rubbish with findnext. change WildFilecmp to use strrchr instead of strchr. This way .. get's matched with *. Fixes Wonderland

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2213
This commit is contained in:
Peter Veenstra 2005-05-31 18:38:54 +00:00
parent 719d57bea9
commit df1b64ffad
2 changed files with 11 additions and 4 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_files.cpp,v 1.62 2005-03-01 19:39:55 qbix79 Exp $ */
/* $Id: dos_files.cpp,v 1.63 2005-05-31 18:38:54 qbix79 Exp $ */
#include <string.h>
#include <stdlib.h>
@ -270,7 +270,14 @@ bool DOS_FindFirst(char * search,Bit16u attr,bool fcb_findfirst) {
bool DOS_FindNext(void) {
DOS_DTA dta(dos.dta());
if (Drives[dta.GetSearchDrive()]->FindNext(dta)) return true;
Bit8u i = dta.GetSearchDrive();
if(i >= DOS_DRIVES || !Drives[i]) {
/* Corrupt search. */
LOG(LOG_FILES,LOG_ERROR)("Corrupt search!!!!");
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
if (Drives[i]->FindNext(dta)) return true;
return false;
}

View file

@ -35,7 +35,7 @@ bool WildFileCmp(const char * file, const char * wild)
strcpy(wild_name," ");
strcpy(wild_ext," ");
find_ext=strchr(file,'.');
find_ext=strrchr(file,'.');
if (find_ext) {
Bitu size=find_ext-file;if (size>8) size=8;
memcpy(file_name,file,size);
@ -45,7 +45,7 @@ bool WildFileCmp(const char * file, const char * wild)
memcpy(file_name,file,(strlen(file) > 8) ? 8 : strlen(file));
}
upcase(file_name);upcase(file_ext);
find_ext=strchr(wild,'.');
find_ext=strrchr(wild,'.');
if (find_ext) {
Bitu size=find_ext-wild;if (size>8) size=8;
memcpy(wild_name,wild,size);