summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormouring <mouring>2001-03-17 00:37:31 +0000
committermouring <mouring>2001-03-17 00:37:31 +0000
commitbafafee7bec516603af79e98ca7915fb25ed8a80 (patch)
tree82cdce0d10d9e7f557790bfb19403631eb494f70
parentfcf6cc0e4de55ea7e4357a717875450f8f3bb0ec (diff)
downloadopenssh-bafafee7bec516603af79e98ca7915fb25ed8a80.tar.gz
- markus@cvs.openbsd.org 2001/03/16 13:44:24
[sftp-int.c] discourage strcat/strcpy
-rw-r--r--ChangeLog5
-rw-r--r--sftp-int.c11
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index a06e8d88..18256d03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,9 @@
- markus@cvs.openbsd.org 2001/03/16 09:55:53
[sftp-int.c]
fix memset and whitespace
+ - markus@cvs.openbsd.org 2001/03/16 13:44:24
+ [sftp-int.c]
+ discourage strcat/strcpy
20010315
- OpenBSD CVS Sync
@@ -4577,4 +4580,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.965 2001/03/17 00:36:17 mouring Exp $
+$Id: ChangeLog,v 1.966 2001/03/17 00:37:31 mouring Exp $
diff --git a/sftp-int.c b/sftp-int.c
index f77e2ebd..8e45f869 100644
--- a/sftp-int.c
+++ b/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 "buffer.h"
#include "xmalloc.h"
@@ -198,11 +198,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);
}