🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Rick Sladkey Wed, 28 Oct 1992 05:35
bug in GNU fileutils-3.3 cp, make_path and re_protect
#6
Author: Rick Sladkey
Date: Wed, 28 Oct 1992 05:35
33 lines
1677 bytes
When using --path with cp from GNU fileutils-3.3, cp sometimes fails
to correctly make leading pathname components because not enough space
is allocated for the trailing null byte before doing a string copy.

Here is a patch.
-----
--- fileutils-3.3/src/cp.c.orig	Fri Jul 17 02:02:32 1992
+++ fileutils-3.3/src/cp.c	Wed Oct 28 00:13:39 1992
@@ -812,13 +812,13 @@
   char *tmp_dst_dirname;	/* Leading path of `dirpath', malloc. */
   char *dst_dirname;		/* Leading path of `dirpath', alloca. */
 
-  dirpath = alloca (strlen (const_dirpath));
+  dirpath = alloca (strlen (const_dirpath) + 1);
   strcpy (dirpath, const_dirpath);
 
   src = dirpath + src_offset;
 
   tmp_dst_dirname = dirname (dirpath); 
-  dst_dirname = alloca (strlen (tmp_dst_dirname));
+  dst_dirname = alloca (strlen (tmp_dst_dirname) + 1);
   strcpy (dst_dirname, tmp_dst_dirname);
   free (tmp_dst_dirname);
 
@@ -931,7 +931,7 @@
   char *dst_path;		/* A copy of CONST_DST_PATH we can change. */
   char *src_path;		/* The source name in `dst_path'. */
 
-  dst_path = alloca (strlen (const_dst_path));
+  dst_path = alloca (strlen (const_dst_path) + 1);
   strcpy (dst_path, const_dst_path);
   src_path = dst_path + src_offset; 
 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads