aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/doscmd/cwd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c
index a5d6c88c83f4..a90c2bb7d1c5 100644
--- a/usr.bin/doscmd/cwd.c
+++ b/usr.bin/doscmd/cwd.c
@@ -198,6 +198,7 @@ dos_makepath(u_char *where, u_char *newpath)
u_char *np;
Path_t *d;
u_char tmppath[1024];
+ u_char snewpath = newpath;
if (where[0] != '\0' && where[1] == ':') {
drive = drlton(*where);
@@ -252,7 +253,7 @@ dos_makepath(u_char *where, u_char *newpath)
} else {
if (np[-1] != '\\')
*np++ = '\\';
- while (*np = *dir++)
+ while (*np = *dir++ && np - snewpath < 1023)
++np;
}
}