Blame SOURCES/rsync-3.2.3-segfault.patch

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