diff options
| author | Thomas Gellekum <tg@FreeBSD.org> | 2001-06-28 12:02:45 +0000 |
|---|---|---|
| committer | Thomas Gellekum <tg@FreeBSD.org> | 2001-06-28 12:02:45 +0000 |
| commit | 5a7e416108de900699fbd277e1a9c00f540c5b87 (patch) | |
| tree | f9a4c60baad4447995b77b4bb2034cc811738867 | |
| parent | ddfe059bf870f4df4b43ba167bd5ed69530b65c4 (diff) | |
Notes
| -rw-r--r-- | usr.bin/doscmd/cwd.c | 8 | ||||
| -rw-r--r-- | usr.bin/doscmd/cwd.h | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c index ef5635f3c885..f7fea8ee3c74 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); diff --git a/usr.bin/doscmd/cwd.h b/usr.bin/doscmd/cwd.h index dfe7e4ea4486..10d97bf25f13 100644 --- a/usr.bin/doscmd/cwd.h +++ b/usr.bin/doscmd/cwd.h @@ -45,7 +45,13 @@ ustrcat(u_char *s1, u_char *s2) } static inline u_char * -ustrncpy(u_char *s1, u_char *s2, unsigned n) +ustrncat(u_char *s1, u_char *s2, size_t n) +{ + return((u_char *)strncat((char *)s1, (char *)s2, n)); +} + +static inline u_char * +ustrncpy(u_char *s1, u_char *s2, size_t n) { return((u_char *)strncpy((char *)s1, (char *)s2, n)); } @@ -57,7 +63,7 @@ ustrcmp(u_char *s1, u_char *s2) } static inline int -ustrncmp(u_char *s1, u_char *s2, unsigned n) +ustrncmp(u_char *s1, u_char *s2, size_t n) { return(strncmp((char *)s1, (char *)s2, n)); } |
