[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sat Jun 13 06:30:09 UTC 2020


The branch, master has been updated
       via  ab0189c8 Make use of poptDupArgv().
       via  bb484a79 The unalias argv array needs room for a trailing NULL.
      from  ad9f1571 Add hashtable to delete_in_dir() to fix -x deletions

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ab0189c81365c0b00e8235a29be67e60cf89a1ab
Author: Wayne Davison <wayne at opencoder.net>
Date:   Fri Jun 12 23:10:44 2020 -0700

    Make use of poptDupArgv().

commit bb484a799e289d3654adeb549b9990fcd9480a5f
Author: Wayne Davison <wayne at opencoder.net>
Date:   Fri Jun 12 23:10:32 2020 -0700

    The unalias argv array needs room for a trailing NULL.

-----------------------------------------------------------------------

Summary of changes:
 NEWS.md   |  6 ++++--
 main.c    | 11 ++++-------
 options.c |  5 +++--
 3 files changed, 11 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS.md b/NEWS.md
index 14a11d7e..bfadccde 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -33,8 +33,6 @@ Protocol: 31 (unchanged)
 
  - Some rrsync fixes and enhancements to handle the latest options.
 
- - Fixed a crash in the `--iconv` code.
-
  - Fixed a problem with the `--link-dest`|`--copy-dest` code when `--xattrs`
    was specified along with multiple alternate-destination directories (it
    could possibly choose a bad file match while trying to find a better xattr
@@ -50,6 +48,10 @@ Protocol: 31 (unchanged)
  - Fixed a mismatch in the RSYNC_PID values when running both a `pre-xfer exec`
    and a `post-xfer exec`.
 
+ - Fixed a crash in the `--iconv` code.
+
+ - Fixed a rare crash in the popt_unalias() code.
+
 ### ENHANCEMENTS:
 
  - Various checksum enhancements, including the optional use of openssl's MD4 &
diff --git a/main.c b/main.c
index 155b178c..90ab43db 100644
--- a/main.c
+++ b/main.c
@@ -26,6 +26,7 @@
 #if defined CONFIG_LOCALE && defined HAVE_LOCALE_H
 #include <locale.h>
 #endif
+#include <popt.h>
 
 extern int dry_run;
 extern int list_only;
@@ -1706,13 +1707,9 @@ int main(int argc,char *argv[])
 		option_error();
 		exit_cleanup(RERR_SYNTAX);
 	}
-	if (write_batch) {
-		int j;
-		cooked_argc = argc;
-		cooked_argv = new_array(char*, argc+1);
-		for (j = 0; j <= argc; j++)
-			cooked_argv[j] = argv[j];
-	}
+	if (write_batch
+	 && poptDupArgv(argc, (const char **)argv, &cooked_argc, (const char ***)&cooked_argv) != 0)
+		out_of_memory("main");
 
 	SIGACTMASK(SIGINT, sig_int);
 	SIGACTMASK(SIGHUP, sig_int);
diff --git a/options.c b/options.c
index 2e0f9da2..b6088405 100644
--- a/options.c
+++ b/options.c
@@ -1287,10 +1287,11 @@ static void popt_unalias(poptContext con, const char *opt)
 {
 	struct poptAlias unalias;
 
+	memset(&unalias, 0, sizeof unalias);
+
 	unalias.longName = opt + 2; /* point past the leading "--" */
-	unalias.shortName = '\0';
 	unalias.argc = 1;
-	unalias.argv = new_array(const char*, 1);
+	unalias.argv = new_array0(const char*, 2);
 	unalias.argv[0] = strdup(opt);
 
 	poptAddAlias(con, unalias, 0);


-- 
The rsync repository.



More information about the rsync-cvs mailing list