Blame SOURCES/rsync-3.2.3-segfault.patch

c13468
From f5a9a1013873580d0ad2ae4f5c5038c324d71bfe Mon Sep 17 00:00:00 2001
c13468
From: Wayne Davison <wayne@opencoder.net>
c13468
Date: Mon, 21 Feb 2022 14:19:31 -0800
c13468
Subject: [PATCH] Fix possible array deref using invalid index.
c13468
c13468
---
c13468
 copy-devices.diff | 6 +++---
c13468
 1 file changed, 3 insertions(+), 3 deletions(-)
c13468
c13468
diff --git a/patches/copy-devices.diff b/patches/copy-devices.diff
c13468
index 797d046..4138474 100644
c13468
--- a/patches/copy-devices.diff
c13468
+++ b/patches/copy-devices.diff
c13468
@@ -111,8 +111,8 @@ diff --git a/rsync.c b/rsync.c
c13468
  	if (iflags & ITEM_TRANSFER) {
c13468
  		int i = ndx - cur_flist->ndx_start;
c13468
 -		if (i < 0 || !S_ISREG(cur_flist->files[i]->mode)) {
c13468
-+		struct file_struct *file = cur_flist->files[i];
c13468
-+		if (i < 0 || !(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) {
c13468
++		if (i < 0
c13468
++		 || !(S_ISREG(cur_flist->files[i]->mode) || (copy_devices && IS_DEVICE(cur_flist->files[i]->mode)))) {
c13468
  			rprintf(FERROR,
c13468
  				"received request to transfer non-regular file: %d [%s]\n",
c13468
  				ndx, who_am_i());