From 0d6d0b8523fdd2f9d3319f051922de43d1be48db Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 7 Mar 2004 12:59:38 +0000 Subject: [PATCH] (with Lucho) -- remove the dosnames path 67 length check. Review the places where it really matters (chdir and mkdir). git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@796 6ac86273-5f31-0410-b378-82cca8765d1b --- filelist | 1 - hdr/dosnames.h | 46 ---------------------------------------------- kernel/dosfns.c | 2 +- kernel/dosnames.c | 3 --- kernel/fatdir.c | 2 +- kernel/fatfs.c | 10 +++++----- kernel/globals.h | 3 +-- kernel/init-mod.h | 1 - 8 files changed, 8 insertions(+), 60 deletions(-) delete mode 100644 hdr/dosnames.h diff --git a/filelist b/filelist index 7eef516..17405f0 100644 --- a/filelist +++ b/filelist @@ -42,7 +42,6 @@ */*/hdr/dcb.h */*/hdr/device.h */*/hdr/dirmatch.h -*/*/hdr/dosnames.h */*/hdr/error.h */*/hdr/exe.h */*/hdr/fat.h diff --git a/hdr/dosnames.h b/hdr/dosnames.h deleted file mode 100644 index aa975c1..0000000 --- a/hdr/dosnames.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************/ -/* */ -/* dosnames.h */ -/* */ -/* FAT File System Name Parse Structure */ -/* */ -/* March 5, 1995 */ -/* */ -/* Copyright (c) 1995 */ -/* Pasquale J. Villani */ -/* All Rights Reserved */ -/* */ -/* This file is part of DOS-C. */ -/* */ -/* DOS-C is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU General Public License */ -/* as published by the Free Software Foundation; either version */ -/* 2, or (at your option) any later version. */ -/* */ -/* DOS-C is distributed in the hope that it will be useful, but */ -/* WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ -/* the GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public */ -/* License along with DOS-C; see the file COPYING. If not, */ -/* write to the Free Software Foundation, 675 Mass Ave, */ -/* Cambridge, MA 02139, USA. */ -/****************************************************************/ - -#ifdef MAIN -#ifdef VERSION_STRINGS -static BYTE *dosnames_hRcsId = - "$Id$"; -#endif -#endif - -#define PARSE_MAX 64 - -struct dosnames { - UBYTE dn_drive; /* the drive that was parsed */ - UBYTE dn_network[PARSE_MAX]; /* specified network */ - UBYTE dn_path[PARSE_MAX]; /* the path */ - UBYTE dn_name[FNAME_SIZE + FEXT_SIZE + 1]; /* the file name */ -}; - diff --git a/kernel/dosfns.c b/kernel/dosfns.c index ba9e787..a7730c9 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -987,7 +987,7 @@ COUNT DosChangeDir(BYTE FAR * s) } if ((FP_OFF(current_ldt) != 0xFFFF) && - (strlen(PriPathName) > sizeof(current_ldt->cdsCurrentPath) - 1)) + (strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath))) return DE_PATHNOTFND; #if defined(CHDIR_DEBUG) diff --git a/kernel/dosnames.c b/kernel/dosnames.c index 18e2735..807cd10 100644 --- a/kernel/dosnames.c +++ b/kernel/dosnames.c @@ -96,9 +96,6 @@ int ParseDosName(const char *filename, char *fcbname, BOOL bAllowWildcards) ++filename; } nDirCnt = lpszLclFile - lpszLclDir; - /* Fix lengths to maximums allowed by MS-DOS. */ - if (nDirCnt > PARSE_MAX - 1) - nDirCnt = PARSE_MAX - 1; /* Parse out the file name portion. */ filename = lpszLclFile; diff --git a/kernel/fatdir.c b/kernel/fatdir.c index fd5881e..5f2b5c5 100644 --- a/kernel/fatdir.c +++ b/kernel/fatdir.c @@ -409,7 +409,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name) /* dirmatch structure and then for every find, we will open the */ /* current directory, do a seek and read, then close the fnode. */ - /* Parse out the drive, file name and file extension. */ + /* Parse out the file name */ i = ParseDosName(name, SearchDir.dir_name, TRUE); if (i < SUCCESS) return i; diff --git a/kernel/fatfs.c b/kernel/fatfs.c index b89d181..41fa836 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -1064,23 +1064,23 @@ COUNT dos_mkdir(BYTE * dir) CLUSTER free_fat, parent; COUNT ret; char fcbname[FNAME_SIZE + FEXT_SIZE]; - - /* first split the passed dir into comopnents (i.e. - */ + + /* first split the passed dir into components (i.e. - */ /* path to new directory and name of new directory */ if ((fnp = split_path(dir, fcbname)) == NULL) { return DE_PATHNOTFND; } - /* check that the resulting combined path does not exceed - the 64 PARSE_MAX limit. this leeds to problems: + /* check that the resulting combined path does not exceed + the 67 MAX_CDSPATH limit. this leads to problems: A) you can't CD to this directory later B) you can't create files in this subdirectory C) the created dir will not be found later, so you can create an unlimited amount of same dirs. this space is lost forever */ - if (strlen(dir) > PARSE_MAX + 2) /* dir is already output of "truename" */ + if (strlen(dir) >= MAX_CDSPATH) /* dir is already output of "truename" */ { dir_close(fnp); return DE_PATHNOTFND; diff --git a/kernel/globals.h b/kernel/globals.h index a981c09..669fce3 100644 --- a/kernel/globals.h +++ b/kernel/globals.h @@ -99,8 +99,7 @@ FAR * ASM DPBp; /* First drive Parameter Block */ /* Constants and macros */ /* */ /* Defaults and limits - System wide */ -#define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */ -#define NAMEMAX PARSE_MAX /* Maximum path for CDS */ +#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */ /* internal error from failure or aborted operation */ #define ERROR -1 diff --git a/kernel/init-mod.h b/kernel/init-mod.h index 3a63973..8265503 100644 --- a/kernel/init-mod.h +++ b/kernel/init-mod.h @@ -70,7 +70,6 @@ void MoveKernel(unsigned NewKernelSegment); #define GLOBAL extern #define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */ -#define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */ #define NFILES 16 /* number of files in table */ #define NFCBS 16 /* number of fcbs */ #define NSTACKS 8 /* number of stacks */