fix buffer overflow

This commit is contained in:
Lukas Nykryn 2023-09-06 12:33:39 +02:00
parent 202e2c344e
commit b9fdb5b1b0
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,25 @@
From a9e6f292f4ce9443ee95c77c60dd8da68d0db7e9 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
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

View File

@ -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 <lnykryn@redhat.com> - 0.5-41.20150602git
- fix buffer overflow
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-40.20150602git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View File

@ -1 +1 @@
033639e6d3e8df2fadc7a6606a0929c8 numad-0.5git.tar.xz
SHA512 (numad-0.5git.tar.xz) = 5f01bf8e8df1497fdf24f9a636035329eb69d28933bc448b87479c253023e25006dee071c582e63f8fdb9a16dce1c840a26059e231b5f58db3d4caa6ede0bebf