From 44f4e4fe20985d5eee47af3e3807e159904e2ccb Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 12 Oct 1999 22:20:18 +0000 Subject: Fix one (of the many) buffer overflows in doscmd. --- usr.bin/doscmd/cwd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } } -- cgit v1.3