!124 [sync] PR-120: Check the length of path

From: @openeuler-sync-bot 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2025-03-18 02:11:17 +00:00 committed by Gitee
commit b19e06108d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From d602002e1982a322d19034a4a64ca5a81bace7ef Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Tue, 25 Feb 2025 16:35:34 +1300
Subject: [PATCH] check_platform_device: Check the length of path
The default length of path is 512, but the strcat() is used without
check if path is overflowed, otherwise a segfault is observed on
some aarch64 machines. This patch will use snprintf instead of strcat
for the buffer length checking.
Signed-off-by: Tao Liu <ltao@redhat.com>
Reference:https://github.com/Irqbalance/irqbalance/commit/d602002e1982a322d19034a4a64ca5a81bace7ef
Conflict:NA
---
procinterrupts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 4d04bf2..e82fac7 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -72,7 +72,8 @@ static int check_platform_device(char *name, struct irq_info *info)
memset(path, 0, 512);
strcat(path, "/sys/devices/platform/");
- strcat(path, name);
+ snprintf(path + strlen(path), sizeof(path) - strlen(path) - 1,
+ "%s", name);
strcat(path, "/");
dirfd = opendir(path);
--
2.28.0.windows.1

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance Name: irqbalance
Version: 1.9.2 Version: 1.9.2
Release: 6 Release: 7
Epoch: 3 Epoch: 3
License: GPLv2 License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
@ -37,6 +37,7 @@ Patch6010: backport-Fix-socket-API-being-blocked-for-10s.patch
Patch6011: backport-Flush-file-before-closing.patch Patch6011: backport-Flush-file-before-closing.patch
Patch6012: backport-Check-fflush-return-value.patch Patch6012: backport-Check-fflush-return-value.patch
Patch6013: backport-fix-32-bit-formats.patch Patch6013: backport-fix-32-bit-formats.patch
Patch6014: backport-check_platform_device-Check-the-length-of-path.patch
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
Patch9001: feature-add-new-user-irq-policy-config-rule.patch Patch9001: feature-add-new-user-irq-policy-config-rule.patch
@ -133,6 +134,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : /sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog %changelog
* Mon Mar 17 2025 langfei <langfei@huawei.com> - 3:1.9.2-7
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: Check the length of path
* Fri Sep 06 2024 lvgenggeng <lvgenggeng@uniontech.com> - 3:1.9.2-6 * Fri Sep 06 2024 lvgenggeng <lvgenggeng@uniontech.com> - 3:1.9.2-6
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA