irqbalance/0001-Safer-string-handling-in-procinterrupts.c.patch
Tao Liu 13f44b8f78 Release 1.9.4-5
Rebase to upstream commit (8e8945e509)

Resolves: RHEL-114948

Signed-off-by: Tao Liu <ltao@redhat.com>
2025-09-30 10:39:19 +13:00

43 lines
1.2 KiB
Diff

From 030edf9aeb7310821df76f3c2965e3d3540e5bba Mon Sep 17 00:00:00 2001
From: Jiri BlueBear Dluhos <jiri.bluebear.dluhos@gmail.com>
Date: Tue, 10 Jun 2025 00:26:47 +0200
Subject: [PATCH 1/3] Safer string handling in procinterrupts.c.
---
procinterrupts.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 8303ad3..16dcff2 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -55,7 +55,7 @@ struct irq_match {
static int check_platform_device(char *name, struct irq_info *info)
{
DIR *dirfd;
- char path[512];
+ char path[PATH_MAX];
struct dirent *ent;
int rc = -ENOENT, i;
static struct pdev_irq_info {
@@ -69,12 +69,11 @@ static int check_platform_device(char *name, struct irq_info *info)
{NULL},
};
- memset(path, 0, 512);
+ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s", name) == PATH_MAX) {
+ log(TO_ALL, LOG_ERROR, "Device path in /sys exceeds maximum length");
+ return -ENAMETOOLONG;
+ }
- strcat(path, "/sys/devices/platform/");
- snprintf(path + strlen(path), sizeof(path) - strlen(path) - 1,
- "%s", name);
- strcat(path, "/");
dirfd = opendir(path);
if (!dirfd) {
--
2.47.0