1 Star 0 Fork 21

fary86/dmidecode

forked from src-openEuler/dmidecode 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dmidecode-Fix-crash-with-u-option.patch 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
openeuler-robot 提交于 2022-02-24 10:56 +08:00 . dmidecode: Fix crash with -u option
From 11e134e54d15e67a64c39a623f492a28df922517 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 19 Jan 2021 16:26:01 +0100
Subject: [PATCH] dmidecode: Fix crash with -u option
A segmentation fault was reported with option -u. Turns out to be a
stupid thinko where the buffer offset was reset at the wrong loop
depth.
Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dmidecode.c b/dmidecode.c
index 572cb1a..69ea0e8 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h)
{
int j, l = strlen(s) + 1;
- off = 0;
for (row = 0; row < ((l - 1) >> 4) + 1; row++)
{
+ off = 0;
for (j = 0; j < 16 && j < l - (row << 4); j++)
off += sprintf(raw_data + off,
j ? " %02X" : "%02X",
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fary86/dmidecode.git
git@gitee.com:fary86/dmidecode.git
fary86
dmidecode
dmidecode
master

搜索帮助