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