[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Tue Jul 7 21:26:09 UTC 2020


The branch, master has been updated
       via  fb6fabc1 Fix an xattr free of the wrong object.
      from  c3269275 Don't use UNUSED() when an arg is used sometimes.

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


- Log -----------------------------------------------------------------
commit fb6fabc116ec12b238c081b3fb57ab33e8eee0aa
Author: Wayne Davison <wayne at opencoder.net>
Date:   Tue Jul 7 14:18:28 2020 -0700

    Fix an xattr free of the wrong object.
    
    In uncache_tmp_xattrs() the code used to find the value to unlink,
    update the single-linked list, and then free the wrong pointer.
    This fixes bug #50.

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

Summary of changes:
 NEWS.md  |  3 +++
 xattrs.c | 15 +++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS.md b/NEWS.md
index 440b8bdc..a3716df5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,6 +8,9 @@
 
  - Fixed the specifying of --bwlimit=0 for the default (unlimited).
 
+ - Fixed a bug in the xattr code that was freeing the wrong object when trying
+   to cleanup the xattr list.
+
 ### ENHANCEMENTS:
 
  - Allow `--max-alloc=0` to specify no limit.
diff --git a/xattrs.c b/xattrs.c
index b3f0c1a3..a7d7d5ab 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -922,17 +922,16 @@ void uncache_tmp_xattrs(void)
 				continue;
 			}
 
-			while (ref != NULL) {
-				if (ref->next == NULL) {
-					ref = NULL;
+			while (1) {
+				rsync_xa_list_ref *next = ref->next;
+				if (next == NULL)
 					break;
-				}
-				if (xa_list_item->ndx == ref->next->ndx) {
-					ref->next = ref->next->next;
-					free(ref);
+				if (xa_list_item->ndx == next->ndx) {
+					ref->next = next->next;
+					free(next);
 					break;
 				}
-				ref = ref->next;
+				ref = next;
 			}
 		}
 		prior_xattr_count = (size_t)-1;


-- 
The rsync repository.



More information about the rsync-cvs mailing list