diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index e51bba67..02ae2450 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -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;