Patch session chooser segfault.

This commit is contained in:
Bojan Smojver 2023-05-19 09:27:28 +10:00
parent c6eb32c54e
commit 7a1d427dc2
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From 8810d46ff11795af2977c54a83d16e5cf1a2ad2a Mon Sep 17 00:00:00 2001
From: matt335672 <30179339+matt335672@users.noreply.github.com>
Date: Mon, 6 Mar 2023 15:42:33 +0000
Subject: [PATCH] Fix regression in list module
---
common/list.c | 13 ++++++-------
tests/common/test_list_calls.c | 5 +++++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/common/list.c b/common/list.c
index 83fde45a2..c23acb756 100644
--- a/common/list.c
+++ b/common/list.c
@@ -205,6 +205,7 @@ list_remove_item(struct list *self, int index)
int
list_insert_item(struct list *self, int index, tbus item)
{
+ int i;
if (index > self->count)
{
@@ -220,16 +221,14 @@ list_insert_item(struct list *self, int index, tbus item)
return 0;
}
- self->count++;
- if (self->count >= 2)
+ // Move all the items above this location up one
+ for (i = self->count ; i > index ; --i)
{
- unsigned int i;
- for (i = (self->count - 2); i >= (unsigned int)index; i--)
- {
- self->items[i + 1] = self->items[i];
- }
+ self->items[i] = self->items[i - 1];
}
+ self->count++;
+
self->items[index] = item;
return 1;
}
diff --git a/tests/common/test_list_calls.c b/tests/common/test_list_calls.c
index af6f41c22..aa098b61a 100644
--- a/tests/common/test_list_calls.c
+++ b/tests/common/test_list_calls.c
@@ -43,6 +43,11 @@ START_TEST(test_list__simple)
val = list_get_item(lst, 10);
ck_assert_int_eq(val, 10);
+ list_insert_item(lst, 0, 99);
+ ck_assert_int_eq(lst->count, TEST_LIST_SIZE + 1);
+ val = list_get_item(lst, 10);
+ ck_assert_int_eq(val, 9);
+
list_clear(lst);
ck_assert_int_eq(lst->count, 0);
list_delete(lst);

View File

@ -17,7 +17,7 @@ Summary: Open source remote desktop protocol (RDP) server
Name: xrdp
Epoch: 1
Version: 0.9.22
Release: 4%{?dist}
Release: 5%{?dist}
License: ASL 2.0 and GPLv2+ and MIT
URL: http://www.xrdp.org/
Source0: https://github.com/neutrinolabs/xrdp/releases/download/v%{version}/xrdp-%{version}.tar.gz
@ -38,6 +38,7 @@ Patch6: xrdp-0.9.18-vnc-uninit.patch
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8
Patch7: xrdp-0.9.20-sesman-ini.patch
%endif
Patch8: xrdp-0.9.22-chooser-segfault.patch
BuildRequires: make
BuildRequires: gcc
@ -289,6 +290,10 @@ fi
%{_datadir}/selinux/*/%{name}.pp
%changelog
* Fri May 19 2023 Bojan Smojver <bojan@rexursive.com> - 1:0.9.22-5
- Patch session chooser segfault
- Bugs #2208015 and #2208248
* Wed May 17 2023 Bojan Smojver <bojan@rexursive.com> - 1:0.9.22-4
- Put back .so files into %%_libdir/xrdp directory
- Bug #2207733