From b9fdb5b1b09611ba164c04cd994e5e9ddf7fb8f4 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Wed, 6 Sep 2023 12:33:39 +0200 Subject: [PATCH] fix buffer overflow --- 0001-numad_log-fix-buffer-overflow.patch | 25 ++++++++++++++++++++++++ numad.spec | 7 ++++++- sources | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 0001-numad_log-fix-buffer-overflow.patch diff --git a/0001-numad_log-fix-buffer-overflow.patch b/0001-numad_log-fix-buffer-overflow.patch new file mode 100644 index 0000000..c67d581 --- /dev/null +++ b/0001-numad_log-fix-buffer-overflow.patch @@ -0,0 +1,25 @@ +From a9e6f292f4ce9443ee95c77c60dd8da68d0db7e9 Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Wed, 6 Sep 2023 12:27:47 +0200 +Subject: [PATCH] numad_log: fix buffer overflow + +--- + numad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numad.c b/numad.c +index 4c85486..2923842 100644 +--- a/numad.c ++++ b/numad.c +@@ -153,7 +153,7 @@ void numad_log(int level, const char *fmt, ...) { + *p++ = ' '; + va_list ap; + va_start(ap, fmt); +- vsnprintf(p, BUF_SIZE, fmt, ap); ++ vsnprintf(p, BUF_SIZE - strlen(buf) , fmt, ap); + va_end(ap); + fprintf(log_fs, "%s", buf); + fflush(log_fs); +-- +2.39.2 + diff --git a/numad.spec b/numad.spec index b9ca110..c97f4e8 100644 --- a/numad.spec +++ b/numad.spec @@ -2,7 +2,7 @@ Name: numad Version: 0.5 -Release: 40.20150602git%{?dist} +Release: 41.20150602git%{?dist} Summary: NUMA user daemon License: LGPL-2.1-only @@ -13,6 +13,7 @@ URL: https://pagure.io/numad # tar --exclude-vcs -cJf numad-0.5git.tar.xz numad-0.5git/ Source0: %{name}-%{version}git.tar.xz Patch0: 0000-remove-conf.patch +Patch1: 0001-numad_log-fix-buffer-overflow.patch Requires: systemd-units Requires(post): systemd-units @@ -31,6 +32,7 @@ and memory to minimize memory latency and thus provide optimum performance. %prep %setup -q -n %{name}-%{version}git %patch0 -p1 +%patch1 -p1 %build make CFLAGS="$RPM_OPT_FLAGS -std=gnu99" LDFLAGS="$RPM_LD_FLAGS -lpthread -lrt -lm" @@ -60,6 +62,9 @@ install -p -m 644 numad.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %systemd_postun numad.service %changelog +* Wed Sep 06 2023 Lukas Nykryn - 0.5-41.20150602git +- fix buffer overflow + * Thu Jul 20 2023 Fedora Release Engineering - 0.5-40.20150602git - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index c095ad4..3a6eedf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -033639e6d3e8df2fadc7a6606a0929c8 numad-0.5git.tar.xz +SHA512 (numad-0.5git.tar.xz) = 5f01bf8e8df1497fdf24f9a636035329eb69d28933bc448b87479c253023e25006dee071c582e63f8fdb9a16dce1c840a26059e231b5f58db3d4caa6ede0bebf