The unalias argv array needs room for a trailing NULL.
authorWayne Davison <wayne@opencoder.net>
Sat, 13 Jun 2020 06:10:32 +0000 (23:10 -0700)
committerWayne Davison <wayne@opencoder.net>
Sat, 13 Jun 2020 06:19:14 +0000 (23:19 -0700)
NEWS.md
options.c

diff --git a/NEWS.md b/NEWS.md
index 14a11d7e2f6b10002bf4eb9bafaf62be5dacb18e..bfadccde757143cdefe09613491dd6b72178b51f 100644 (file)
--- 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 &
index 2e0f9da2c2a398418a2d00f48280a64e85895e7b..b60884051aa6446e740d28c23b114bfac7cd8793 100644 (file)
--- 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);