(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
This commit is contained in:
Bart Oldeman 2004-03-07 12:59:38 +00:00
parent 3e3c05ff22
commit 0d6d0b8523
8 changed files with 8 additions and 60 deletions

View File

@ -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

View File

@ -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 */
};

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -1065,7 +1065,7 @@ COUNT dos_mkdir(BYTE * dir)
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)
{
@ -1073,14 +1073,14 @@ COUNT dos_mkdir(BYTE * dir)
}
/* check that the resulting combined path does not exceed
the 64 PARSE_MAX limit. this leeds to problems:
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;

View File

@ -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

View File

@ -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 */