From 92d9c6e18dfae7f33baf1ea28063846c289a22b3e259a6b08fd63f8d18c88534 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 22 Jun 2022 08:25:46 +0000 Subject: [PATCH 1/2] Accepting request 984287 from home:cyphar:rtorrent - Backport fix which resolves a crashing issue on startup on openSUSE. https://github.com/rakshasa/rtorrent/pull/1169 + 0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch OBS-URL: https://build.opensuse.org/request/show/984287 OBS-URL: https://build.opensuse.org/package/show/filesharing/rtorrent?expand=0&rev=8 --- ...void-stack-overflow-for-lockfile-buf.patch | 27 +++++++++++++++++++ rtorrent.changes | 9 ++++++- rtorrent.spec | 3 +++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch diff --git a/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch b/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch new file mode 100644 index 0000000..e291d48 --- /dev/null +++ b/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch @@ -0,0 +1,27 @@ +From 954bfb70f24578ef33b1f77cf1a3d64fc2f2f595 Mon Sep 17 00:00:00 2001 +From: Aleksa Sarai +Date: Mon, 20 Jun 2022 19:09:57 +1000 +Subject: [PATCH] utils: lockfile: avoid stack overflow for lockfile buffer + +Signed-off-by: Aleksa Sarai +--- + src/utils/lockfile.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/utils/lockfile.cc b/src/utils/lockfile.cc +index 7d11d8c9970f..fac5cb23e26f 100644 +--- a/src/utils/lockfile.cc ++++ b/src/utils/lockfile.cc +@@ -98,7 +98,8 @@ Lockfile::try_lock() { + int pos = ::gethostname(buf, 255); + + if (pos == 0) { +- ::snprintf(buf + std::strlen(buf), 255, ":+%i\n", ::getpid()); ++ ssize_t len = std::strlen(buf); ++ ::snprintf(buf + len, 255 - len, ":+%i\n", ::getpid()); + int __UNUSED result = ::write(fd, buf, std::strlen(buf)); + } + +-- +2.36.1 + diff --git a/rtorrent.changes b/rtorrent.changes index 52300e2..9280888 100644 --- a/rtorrent.changes +++ b/rtorrent.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jun 21 00:28:35 UTC 2022 - Aleksa Sarai + +- Backport fix which resolves a crashing issue on startup on openSUSE. + https://github.com/rakshasa/rtorrent/pull/1169 + + 0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch + ------------------------------------------------------------------- Tue Nov 16 12:09:53 UTC 2021 - Johannes Segitz @@ -51,7 +58,7 @@ Wed Jul 24 17:52:33 UTC 2019 - hiwatari.seiji@gmail.com * Fix no // are at start of expanded paths. (pyroscope) * Fix ncurses header include. (theirix) * Fix segfault when viewing a magnet download in the leeching view. (slingamn) - + - Remove rtorrent-vim package because it was made for the old (now discouraged) config syntax * See: https://github.com/rakshasa/rtorrent/wiki/CONFIG-Template diff --git a/rtorrent.spec b/rtorrent.spec index a1e4fab..a1bc8fb 100644 --- a/rtorrent.spec +++ b/rtorrent.spec @@ -29,6 +29,8 @@ Source2: rtorrent.desktop # This manpage copied from the 0.9.2 tarball as it was missing in later versions Source3: rtorrent.1 Source4: rtorrent.service +# FIX-UPSTREAM: Backport of . +Patch1: 0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch BuildRequires: automake BuildRequires: gcc-c++ BuildRequires: libtool @@ -48,6 +50,7 @@ management. %prep %setup -q +%patch1 -p1 %build # It's full of type pun violations From bb80c34131dc1b248ecf62a61425cba80b24d6d8d2c882368d3bb8c9ff658e68 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 22 Jun 2022 08:28:55 +0000 Subject: [PATCH 2/2] put upstream reference together with the patch OBS-URL: https://build.opensuse.org/package/show/filesharing/rtorrent?expand=0&rev=9 --- ...ils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch | 1 + rtorrent.spec | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch b/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch index e291d48..4acab1b 100644 --- a/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch +++ b/0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch @@ -2,6 +2,7 @@ From 954bfb70f24578ef33b1f77cf1a3d64fc2f2f595 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Mon, 20 Jun 2022 19:09:57 +1000 Subject: [PATCH] utils: lockfile: avoid stack overflow for lockfile buffer +References: https://github.com/rakshasa/rtorrent/pull/1169 Signed-off-by: Aleksa Sarai --- diff --git a/rtorrent.spec b/rtorrent.spec index a1bc8fb..fbad7c3 100644 --- a/rtorrent.spec +++ b/rtorrent.spec @@ -1,7 +1,7 @@ # # spec file for package rtorrent # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,7 +29,6 @@ Source2: rtorrent.desktop # This manpage copied from the 0.9.2 tarball as it was missing in later versions Source3: rtorrent.1 Source4: rtorrent.service -# FIX-UPSTREAM: Backport of . Patch1: 0001-utils-lockfile-avoid-stack-overflow-for-lockfile-buf.patch BuildRequires: automake BuildRequires: gcc-c++ @@ -49,8 +48,7 @@ background using screen. It supports fast-resume and session management. %prep -%setup -q -%patch1 -p1 +%autosetup -p1 %build # It's full of type pun violations