From 401d1296942f22cfa60097389ce74c76851308c0 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Fri, 9 Jan 2015 08:57:43 +0000 Subject: [PATCH] Fix bug 392. '\0' check at the wrong place. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3887 --- src/shell/shell_misc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;