irqbalance: check whether savedptr is NULL before invoking strlen

check whether savedptr is NULL before invoking strlen

Signed-off-by: qinyu <qinyu32@huawei.com>
This commit is contained in:
qinyu 2023-01-05 15:49:15 +08:00
parent 450e509daa
commit 654999b7f1
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 522883505d3b02e3294f045f49007b61c00e2c31 Mon Sep 17 00:00:00 2001
From: Chao Liu <liuchao173@huawei.com>
Date: Wed, 8 Jun 2022 10:04:02 +0800
Subject: [PATCH] check whether savedptr is NULL before invoking strlen
Reference: https://github.com/Irqbalance/irqbalance/commit/522883505d3b02e3294f045f49007b61c00e2c31
Conflict: NA
savedptr can be null in musl libc, so the strlen(NULL) will segfault
Signed-off-by: Chao Liu <liuchao173@huawei.com>
---
procinterrupts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 9015177..57c8801 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -178,7 +178,7 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- if (strlen(savedptr) > 0) {
+ if (savedptr && strlen(savedptr) > 0) {
snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
tmp = strchr(irq_fullname, '\n');
if (tmp)
--
2.33.0

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.7.0
Release: 18
Release: 19
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz
@ -37,6 +37,7 @@ Patch6012: backport-Add-0-to-the-end-of-strings-to-avoid-heap-buffer-ove.patch
Patch6013: backport-Fix-parse_proc_interrupts-fix-parsing-interrupt-counts.patch
Patch6014: backport-Fix-add-keep_going-check-to-prevent-irqbalance-from-failing-to-exit-after-SIGTERM.patch
Patch6015: backport-fix-opendir-fails-in-check_platform_device.patch
Patch6016: backport-check-whether-savedptr-is-NULL-before-invoking-strle.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -94,6 +95,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-19
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: check whether savedptr is NULL before invoking strlen
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-18
- Type:bugfix
- ID:NA