1
0
Fork 0

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:
Peter Veenstra 2015-01-09 08:57:43 +00:00
parent 933174fb3e
commit 401d129694

View file

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