From: Jim Meyering Date: Sun, 4 Jan 2004 21:07:16 +0000 (+0000) Subject: (re_protect): Use ASSIGN_STRDUPA rather than alloca and strcpy. X-Git-Tag: v5.1.1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68eb5f3e0d6b1c8eb70ae107bc06799da726019a;p=thirdparty%2Fcoreutils.git (re_protect): Use ASSIGN_STRDUPA rather than alloca and strcpy. (make_path_private): Likewise. --- diff --git a/src/cp.c b/src/cp.c index e92d819dd9..48ece6a89f 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;