summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd/cwd.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-10-12 22:20:18 +0000
committerimp <imp@FreeBSD.org>1999-10-12 22:20:18 +0000
commit7ec76e001993314b77b5eb328935241e9ffc4f6f (patch)
treef865ca4bf28740e484d25ad9c76f9399d2c3e29e /usr.bin/doscmd/cwd.c
parentaaf5afc559ee01cf65d4a7cc2e849052a96534a7 (diff)
downloadFreeBSD-src-7ec76e001993314b77b5eb328935241e9ffc4f6f.zip
FreeBSD-src-7ec76e001993314b77b5eb328935241e9ffc4f6f.tar.gz
Fix one (of the many) buffer overflows in doscmd.
Diffstat (limited to 'usr.bin/doscmd/cwd.c')
-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 a5d6c88..a90c2bb 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;
}
}
OpenPOWER on IntegriCloud