Fix bug 392.
'\0' check at the wrong place. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3887
This commit is contained in:
parent
933174fb3e
commit
401d129694
1 changed files with 3 additions and 3 deletions
|
@ -550,13 +550,13 @@ char * DOS_Shell::Which(char * name) {
|
|||
if (!GetEnvStr("PATH",temp)) return 0;
|
||||
const char * pathenv=temp.c_str();
|
||||
if (!pathenv) return 0;
|
||||
pathenv=strchr(pathenv,'=');
|
||||
pathenv = strchr(pathenv,'=');
|
||||
if (!pathenv) return 0;
|
||||
pathenv++;
|
||||
Bitu i_path = 0;
|
||||
while (*pathenv) {
|
||||
/* remove ; and ;; at the beginning. (and from the second entry etc) */
|
||||
while(*pathenv && (*pathenv ==';'))
|
||||
while(*pathenv == ';')
|
||||
pathenv++;
|
||||
|
||||
/* get next entry */
|
||||
|
@ -566,7 +566,7 @@ char * DOS_Shell::Which(char * name) {
|
|||
|
||||
if(i_path == DOS_PATHLENGTH) {
|
||||
/* If max size. move till next ; and terminate path */
|
||||
while(*pathenv != ';')
|
||||
while(*pathenv && (*pathenv != ';'))
|
||||
pathenv++;
|
||||
path[DOS_PATHLENGTH - 1] = 0;
|
||||
} else path[i_path] = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue