From 68eb5f3e0d6b1c8eb70ae107bc06799da726019a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 4 Jan 2004 21:07:16 +0000 Subject: (re_protect): Use ASSIGN_STRDUPA rather than alloca and strcpy. (make_path_private): Likewise. --- src/cp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/cp.c') diff --git a/src/cp.c b/src/cp.c index e92d819dd..48ece6a89 100644 --- a/src/cp.c +++ b/src/cp.c @@ -285,8 +285,7 @@ re_protect (const char *const_dst_path, int src_offset, char *src_path; /* The source name in `dst_path'. */ uid_t myeuid = geteuid (); - dst_path = alloca (strlen (const_dst_path) + 1); - strcpy (dst_path, const_dst_path); + ASSIGN_STRDUPA (dst_path, const_dst_path); src_path = dst_path + src_offset; for (p = attr_list; p; p = p->next) @@ -383,8 +382,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode, char *dst_dirname; /* Leading path of `dirpath'. */ size_t dirlen; /* Length of leading path of `dirpath'. */ - dirpath = alloca (strlen (const_dirpath) + 1); - strcpy (dirpath, const_dirpath); + ASSIGN_STRDUPA (dirpath, const_dirpath); src = dirpath + src_offset; -- cgit v1.2.3-54-g00ecf