From: Brandon Turner Date: Sun, 21 Aug 2005 20:44:47 +0000 (+0000) Subject: Fix a CD bug spotted by ravelo_. This is simlair to bug 690. cd foo\"bar", cd ... X-Git-Tag: ReactOS-0.2.8~936 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=1fb85e029e073abbc8611dea39e2b473edc67a8e Fix a CD bug spotted by ravelo_. This is simlair to bug 690. cd foo\"bar", cd "foo"\"bar"" and other of the sorts are all valid. svn path=/trunk/; revision=17469 --- diff --git a/reactos/subsys/system/cmd/internal.c b/reactos/subsys/system/cmd/internal.c index 5a0fe529d0f..32e7777482b 100644 --- a/reactos/subsys/system/cmd/internal.c +++ b/reactos/subsys/system/cmd/internal.c @@ -315,17 +315,14 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param) /* Get Current Directory */ GetRootPath(_T("."),szCurrent,MAX_PATH); - /* Remove " */ - if(szPath[0] == _T('\"')) + /* Remove " */ + i = 0; + while(i < _tcslen(szPath)) { - tmpPath = _tcsstr(szPath,_T("\"")); - tmpPath++; - _tcscpy(szPath,tmpPath); - } - - if(szPath[_tcslen(szPath) - 1] == _T('\"')) - { - szPath[_tcslen(szPath) - 1] = _T('\0'); + if(szPath[i] == _T('\"')) + memmove(&szPath[i],&szPath[i + 1], _tcslen(&szPath[i]) * sizeof(TCHAR)); + else + i++; } tmpPath = szPath; @@ -339,7 +336,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param) return 0; } - + /* change to full path if relative path was given */ GetFullPathName(szPath,MAX_PATH,szFinalPath,NULL);