Added upstream patch to fix segmentation fault for '-r' (#2188394)

This commit is contained in:
Robert Scheck 2023-04-21 23:24:45 +02:00
parent 299d346aad
commit 15fe7bf50d
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 5908af4c19188cb17b62f23368b6ef462831a0cb Mon Sep 17 00:00:00 2001
From: Marcus Meissner <meissner@suse.de>
Date: Tue, 11 Apr 2023 16:05:36 +0200
Subject: [PATCH] fixed the sizes passed into snprintf
---
ui/report.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/report.c b/ui/report.c
index 9301480..61f2c74 100644
--- a/ui/report.c
+++ b/ui/report.c
@@ -140,7 +140,7 @@ void report_close(
continue;
snprintf(fmt, sizeof(fmt), "%%%ds", data_fields[j].length);
- snprintf(buf + len, sizeof(buf), fmt, data_fields[j].title);
+ snprintf(buf + len, sizeof(buf) - len, fmt, data_fields[j].title);
len += data_fields[j].length;
}
printf("%s\n", buf);
@@ -172,10 +172,10 @@ void report_close(
/* 1000.0 is a temporary hack for stats usec to ms, impacted net_loss. */
if (strchr(data_fields[j].format, 'f')) {
- snprintf(buf + len, sizeof(buf), data_fields[j].format,
+ snprintf(buf + len, sizeof(buf) - len, data_fields[j].format,
data_fields[j].net_xxx(at) / 1000.0);
} else {
- snprintf(buf + len, sizeof(buf), data_fields[j].format,
+ snprintf(buf + len, sizeof(buf) - len, data_fields[j].format,
data_fields[j].net_xxx(at));
}
len += data_fields[j].length;

View File

@ -3,12 +3,14 @@
Summary: Network diagnostic tool combining 'traceroute' and 'ping'
Name: mtr
Version: 0.95
Release: 4%{?dist}
Release: 5%{?dist}
Epoch: 2
License: GPLv2
License: GPL-2.0-only
URL: https://www.bitwizard.nl/mtr/
Source0: https://github.com/traviscross/mtr/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: net-x%{name}.desktop
# https://github.com/traviscross/mtr/issues/469
Patch0: https://github.com/traviscross/mtr/commit/5908af4c19188cb17b62f23368b6ef462831a0cb.patch#/mtr-0.95-snprintf-sizes.patch
BuildRequires: gcc make ncurses-devel libcap-devel jansson-devel
BuildRequires: autoconf automake libtool git
@ -47,6 +49,7 @@ about each machine.
%prep
%setup -q
%patch0 -p1 -b .snprintf-sizes
%build
./bootstrap.sh
@ -78,6 +81,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%{_datadir}/applications/net-x%{name}.desktop
%changelog
* Fri Apr 21 2023 Robert Scheck <robert@fedoraproject.org> - 2:0.95-5
- Added upstream patch to fix segmentation fault for '-r' (#2188394)
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2:0.95-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild