diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-03-16 13:44:25 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-03-16 13:44:25 +0000 |
commit | 5bb88a14eecbaa8615f3cc16eb91ce9482850191 (patch) | |
tree | a5366a32b0fad7e9e582e9e51efb4951e6ce2127 /usr.bin | |
parent | 837c5c9df068deee023d3b776e126c30ef71f7b3 (diff) |
discourage strcat/strcpy
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sftp-int.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/ssh/sftp-int.c b/usr.bin/ssh/sftp-int.c index 0c8bdd88042..6240bf96a0b 100644 --- a/usr.bin/ssh/sftp-int.c +++ b/usr.bin/ssh/sftp-int.c @@ -26,7 +26,7 @@ /* XXX: recursive operations */ #include "includes.h" -RCSID("$OpenBSD: sftp-int.c,v 1.30 2001/03/16 09:55:53 markus Exp $"); +RCSID("$OpenBSD: sftp-int.c,v 1.31 2001/03/16 13:44:24 markus Exp $"); #include <glob.h> @@ -200,11 +200,12 @@ char * path_append(char *p1, char *p2) { char *ret; + int len = strlen(p1) + strlen(p2) + 2; - ret = xmalloc(strlen(p1) + strlen(p2) + 2); - strcpy(ret, p1); - strcat(ret, "/"); - strcat(ret, p2); + ret = xmalloc(len); + strlcpy(ret, p1, len); + strlcat(ret, "/", len); + strlcat(ret, p2, len); return(ret); } |