Don't allow wildcards for internal truename processing, except for

DosFindfirst and DosTruename.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@536 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2003-03-12 06:50:33 +00:00
parent ec8b97be38
commit 9bcd6b125a
3 changed files with 6 additions and 2 deletions

View File

@ -94,3 +94,4 @@ struct cds {
#define CDS_MODE_SKIP_PHYSICAL 0x01 /* don't resolve SUBST, JOIN, NETW */ #define CDS_MODE_SKIP_PHYSICAL 0x01 /* don't resolve SUBST, JOIN, NETW */
#define CDS_MODE_CHECK_DEV_PATH 0x02 /* check for existence of device path */ #define CDS_MODE_CHECK_DEV_PATH 0x02 /* check for existence of device path */
#define CDS_MODE_ALLOW_WILDCARDS 0x04 /* allow wildcards in "truename" */

View File

@ -1009,7 +1009,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
int rc; int rc;
register dmatch FAR *dmp = dta; register dmatch FAR *dmp = dta;
rc = truename(name, PriPathName, CDS_MODE_CHECK_DEV_PATH); rc = truename(name, PriPathName,
CDS_MODE_CHECK_DEV_PATH | CDS_MODE_ALLOW_WILDCARDS);
if (rc < SUCCESS) if (rc < SUCCESS)
return rc; return rc;
@ -1546,7 +1547,7 @@ COUNT DosTruename(const char FAR *src, char FAR *dest)
Therefore, the name is created in an internal buffer Therefore, the name is created in an internal buffer
and copied into the user buffer only on success. and copied into the user buffer only on success.
*/ */
COUNT rc = truename(src, PriPathName, 0); COUNT rc = truename(src, PriPathName, CDS_MODE_ALLOW_WILDCARDS);
if (rc >= SUCCESS) if (rc >= SUCCESS)
fstrcpy(dest, PriPathName); fstrcpy(dest, PriPathName);
return rc; return rc;

View File

@ -532,6 +532,8 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
break; break;
} }
} }
if (gotAnyWildcards && !(mode & CDS_MODE_ALLOW_WILDCARDS))
return DE_PATHNOTFND;
if (addSep == ADD || p == dest + 2) if (addSep == ADD || p == dest + 2)
{ {
/* MS DOS preserves a trailing '\\', so an access to "C:\\DOS\\" /* MS DOS preserves a trailing '\\', so an access to "C:\\DOS\\"