[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH] dmidecode: Increase the size of raw_data in dmi_dump
From: |
Yang Yanchao |
Subject: |
[dmidecode] [PATCH] dmidecode: Increase the size of raw_data in dmi_dump and prevent overwriting. |
Date: |
Wed, 23 Feb 2022 17:59:13 +0800 |
Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com>
---
dmidecode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 3147d4d..9f8f66e 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -222,7 +222,7 @@ static int dmi_bcd_range(u8 value, u8 low, u8 high)
static void dmi_dump(const struct dmi_header *h)
{
- static char raw_data[48];
+ static char raw_data[99];
int row, i;
unsigned int off;
char *s;
@@ -231,7 +231,7 @@ static void dmi_dump(const struct dmi_header *h)
for (row = 0; row < ((h->length - 1) >> 4) + 1; row++)
{
off = 0;
- for (i = 0; i < 16 && i < h->length - (row << 4); i++)
+ for (i = 0; i < 16 && i < h->length - (row << 4) && off < 98;
i++)
off += sprintf(raw_data + off, i ? " %02X" : "%02X",
(h->data)[(row << 4) + i]);
pr_list_item(raw_data);
@@ -251,7 +251,7 @@ static void dmi_dump(const struct dmi_header *h)
for (row = 0; row < ((l - 1) >> 4) + 1; row++)
{
off = 0;
- for (j = 0; j < 16 && j < l - (row <<
4); j++)
+ for (j = 0; j < 16 && j < l - (row <<
4) && off < 98; j++)
off += sprintf(raw_data + off,
j ? " %02X" : "%02X",
(unsigned char)s[(row <<
4) + j]);
--
2.33.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dmidecode] [PATCH] dmidecode: Increase the size of raw_data in dmi_dump and prevent overwriting.,
Yang Yanchao <=