mirror of https://github.com/FDOS/kernel.git
(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:
parent
3e3c05ff22
commit
0d6d0b8523
1
filelist
1
filelist
|
@ -42,7 +42,6 @@
|
||||||
*/*/hdr/dcb.h
|
*/*/hdr/dcb.h
|
||||||
*/*/hdr/device.h
|
*/*/hdr/device.h
|
||||||
*/*/hdr/dirmatch.h
|
*/*/hdr/dirmatch.h
|
||||||
*/*/hdr/dosnames.h
|
|
||||||
*/*/hdr/error.h
|
*/*/hdr/error.h
|
||||||
*/*/hdr/exe.h
|
*/*/hdr/exe.h
|
||||||
*/*/hdr/fat.h
|
*/*/hdr/fat.h
|
||||||
|
|
|
@ -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 */
|
|
||||||
};
|
|
||||||
|
|
|
@ -987,7 +987,7 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((FP_OFF(current_ldt) != 0xFFFF) &&
|
if ((FP_OFF(current_ldt) != 0xFFFF) &&
|
||||||
(strlen(PriPathName) > sizeof(current_ldt->cdsCurrentPath) - 1))
|
(strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath)))
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
#if defined(CHDIR_DEBUG)
|
#if defined(CHDIR_DEBUG)
|
||||||
|
|
|
@ -96,9 +96,6 @@ int ParseDosName(const char *filename, char *fcbname, BOOL bAllowWildcards)
|
||||||
++filename;
|
++filename;
|
||||||
}
|
}
|
||||||
nDirCnt = lpszLclFile - lpszLclDir;
|
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. */
|
/* Parse out the file name portion. */
|
||||||
filename = lpszLclFile;
|
filename = lpszLclFile;
|
||||||
|
|
|
@ -409,7 +409,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name)
|
||||||
/* dirmatch structure and then for every find, we will open the */
|
/* dirmatch structure and then for every find, we will open the */
|
||||||
/* current directory, do a seek and read, then close the fnode. */
|
/* 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);
|
i = ParseDosName(name, SearchDir.dir_name, TRUE);
|
||||||
if (i < SUCCESS)
|
if (i < SUCCESS)
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ COUNT dos_mkdir(BYTE * dir)
|
||||||
COUNT ret;
|
COUNT ret;
|
||||||
char fcbname[FNAME_SIZE + FEXT_SIZE];
|
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 */
|
/* path to new directory and name of new directory */
|
||||||
if ((fnp = split_path(dir, fcbname)) == NULL)
|
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
|
/* 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
|
A) you can't CD to this directory later
|
||||||
B) you can't create files in this subdirectory
|
B) you can't create files in this subdirectory
|
||||||
C) the created dir will not be found later, so you
|
C) the created dir will not be found later, so you
|
||||||
can create an unlimited amount of same dirs. this space
|
can create an unlimited amount of same dirs. this space
|
||||||
is lost forever
|
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);
|
dir_close(fnp);
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
|
|
|
@ -99,8 +99,7 @@ FAR * ASM DPBp; /* First drive Parameter Block */
|
||||||
/* Constants and macros */
|
/* Constants and macros */
|
||||||
/* */
|
/* */
|
||||||
/* Defaults and limits - System wide */
|
/* Defaults and limits - System wide */
|
||||||
#define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */
|
#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */
|
||||||
#define NAMEMAX PARSE_MAX /* Maximum path for CDS */
|
|
||||||
|
|
||||||
/* internal error from failure or aborted operation */
|
/* internal error from failure or aborted operation */
|
||||||
#define ERROR -1
|
#define ERROR -1
|
||||||
|
|
|
@ -70,7 +70,6 @@ void MoveKernel(unsigned NewKernelSegment);
|
||||||
|
|
||||||
#define GLOBAL extern
|
#define GLOBAL extern
|
||||||
#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */
|
#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 NFILES 16 /* number of files in table */
|
||||||
#define NFCBS 16 /* number of fcbs */
|
#define NFCBS 16 /* number of fcbs */
|
||||||
#define NSTACKS 8 /* number of stacks */
|
#define NSTACKS 8 /* number of stacks */
|
||||||
|
|
Loading…
Reference in New Issue