diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-07-09 17:11:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-07-09 17:11:23 +0000 |
commit | e5bfd68637432486445bc75c5000df2b0c09d429 (patch) | |
tree | 73b50e9db88d096b07d39511c7c49b357d5e7ade | |
parent | 2d14d59facebb1adf97e8ddaf8108ab56739aee4 (diff) |
You can only use strlcpy() on real C strings, which lf->buffer is not.
Use memcpy() instead and NUL terminate.
-rw-r--r-- | usr.bin/ftp/complete.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/ftp/complete.c b/usr.bin/ftp/complete.c index 9c030d51a99..4c555705b16 100644 --- a/usr.bin/ftp/complete.c +++ b/usr.bin/ftp/complete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: complete.c,v 1.14 2003/04/05 17:19:47 deraadt Exp $ */ +/* $OpenBSD: complete.c,v 1.15 2004/07/09 17:11:22 millert Exp $ */ /* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */ /*- @@ -39,7 +39,7 @@ #ifndef SMALL #ifndef lint -static char rcsid[] = "$OpenBSD: complete.c,v 1.14 2003/04/05 17:19:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: complete.c,v 1.15 2004/07/09 17:11:22 millert Exp $"; #endif /* not lint */ /* @@ -314,7 +314,8 @@ complete(el, ch) len = lf->lastchar - lf->buffer; if (len >= sizeof(line)) return (CC_ERROR); - (void)strlcpy(line, lf->buffer, len+1); + (void)memcpy(line, lf->buffer, len); + line[len] = '\0'; cursor_pos = line + (lf->cursor - lf->buffer); lastc_argc = cursor_argc; /* remember last cursor pos */ lastc_argo = cursor_argo; |