!130 [sync] PR-128: Check the length of path
From: @openeuler-sync-bot Reviewed-by: @SuperSix173 Signed-off-by: @SuperSix173
This commit is contained in:
commit
389a7dd312
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: A dynamic adaptive IRQ balancing daemon
|
||||
Name: irqbalance
|
||||
Version: 1.8.0
|
||||
Release: 13
|
||||
Release: 14
|
||||
Epoch: 3
|
||||
License: GPLv2
|
||||
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
|
||||
@ -42,6 +42,7 @@ Patch6017: backport-activate_mapping-set-errsave-before-first-jump-to-th.patch
|
||||
Patch6018: backport-Fix-socket-API-being-blocked-for-10s.patch
|
||||
Patch6019: backport-Flush-file-before-closing.patch
|
||||
Patch6020: backport-Check-fflush-return-value.patch
|
||||
Patch6021: backport-check_platform_device-Check-the-length-of-path.patch
|
||||
|
||||
%description
|
||||
Irqbalance is a daemon to help balance the cpu load generated by
|
||||
@ -99,6 +100,12 @@ fi
|
||||
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Tue Mar 18 2025 langfei <langfei@huawei.com> - 3:1.8.0-14
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:restart
|
||||
- DESC: Check the length of path
|
||||
|
||||
* Tue May 07 2024 langfei <langfei@huawei.com> - 3:1.8.0-13
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user