summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd/cwd.c
diff options
context:
space:
mode:
authortg <tg@FreeBSD.org>2001-06-28 12:02:45 +0000
committertg <tg@FreeBSD.org>2001-06-28 12:02:45 +0000
commitd021e1859a25ba73f0a0e3caa922f34a7a3c1077 (patch)
treef9a4c60baad4447995b77b4bb2034cc811738867 /usr.bin/doscmd/cwd.c
parentc88bce56d6354296c2d4a484162c2e08b1989d8c (diff)
downloadFreeBSD-src-d021e1859a25ba73f0a0e3caa922f34a7a3c1077.zip
FreeBSD-src-d021e1859a25ba73f0a0e3caa922f34a7a3c1077.tar.gz
Fix another buffer overflow.
PR: 15593 Submitted by: Przemyslaw Frasunek <venglin@lagoon.FreeBSD.lublin.pl>
Diffstat (limited to 'usr.bin/doscmd/cwd.c')
-rw-r--r--usr.bin/doscmd/cwd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c
index ef5635f..f7fea8e 100644
--- a/usr.bin/doscmd/cwd.c
+++ b/usr.bin/doscmd/cwd.c
@@ -225,12 +225,12 @@ dos_makepath(u_char *where, u_char *newpath)
np = newpath;
if (*where != '\\' && *where != '/') {
- ustrcpy(tmppath, d->cwd);
+ ustrncpy(tmppath, d->cwd, 1024);
if (d->cwd[1])
- ustrcat(tmppath, (u_char *)"/");
- ustrcat(tmppath, where);
+ ustrncat(tmppath, (u_char *)"/", 1024 - ustrlen(tmppath));
+ ustrncat(tmppath, where, 1024 - ustrlen(tmppath));
} else {
- ustrcpy(tmppath, where);
+ ustrncpy(tmppath, where, 1024 - ustrlen(tmppath));
}
dirs = get_entries(tmppath);
OpenPOWER on IntegriCloud