Blame SOURCES/irqbalance-1.4.0-Fix-an-possible-overflow-error.patch

a48aee
From 16cb6df56960f58df61ec35ef3be45286eb3c788 Mon Sep 17 00:00:00 2001
a48aee
From: Kairui Song <kasong@redhat.com>
a48aee
Date: Sun, 2 Sep 2018 23:40:45 +0800
a48aee
Subject: [PATCH 2/4] Fix an possible overflow error
a48aee
a48aee
Got:
a48aee
"specified bound 2048 exceeds the size 19 of the destination"
a48aee
when -O2 is used, and a "*** buffer overflow detected ***" error output
a48aee
with no backtrace.
a48aee
a48aee
With -O0, it's gone, guess it's some gcc optimization problem, and the
a48aee
size there is wrong anyway, this patch could fix it.
a48aee
---
a48aee
 irqbalance.c | 4 ++--
a48aee
 1 file changed, 2 insertions(+), 2 deletions(-)
a48aee
a48aee
diff --git a/irqbalance.c b/irqbalance.c
a48aee
index 4b3de54..c89c3c0 100644
a48aee
--- a/irqbalance.c
a48aee
+++ b/irqbalance.c
a48aee
@@ -457,8 +457,8 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri
a48aee
 		}
a48aee
 		if (!strncmp(buff, "setup", strlen("setup"))) {
a48aee
 			char banned[512];
a48aee
-			char *setup = calloc(strlen("SLEEP  ") + 11 +1, 1);
a48aee
-			snprintf(setup, 2048, "SLEEP %d ", sleep_interval);
a48aee
+			char *setup = calloc(strlen("SLEEP  ") + 11 + 1, 1);
a48aee
+			snprintf(setup, strlen("SLEEP  ") + 11 + 1, "SLEEP %d ", sleep_interval);
a48aee
 			if(g_list_length(cl_banned_irqs) > 0) {
a48aee
 				for_each_irq(cl_banned_irqs, get_irq_data, setup);
a48aee
 			}
a48aee
-- 
a48aee
2.17.1
a48aee