1 Star 0 Fork 38

huyab/rsyslog

forked from src-openEuler/rsyslog 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
backport-Fix-non-null-terminated-string-used-with-strlen.patch 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
周文培 提交于 2022-08-04 15:45 +08:00 . backport patches from upstream and enable check
From 6aeec7bf83135224400362598f0cc7ebef655195 Mon Sep 17 00:00:00 2001
From: David Buckley <davidbuckley@gambitresearch.com>
Date: Tue, 12 Apr 2022 17:38:49 +0100
Subject: [PATCH] Fix non-null-terminated-string used with strlen
The `failedmsg_entry` expects a null-terminated string in `key`, but
here we allocate with malloc and copy a string-with-length-n into only
the first n bytes. If the final byte is null, this is by coincidence
only.
We've observed this by means of seeing random binary data appended to
keys submitted to kafka apparently at random, and this looks like a
smoking gun.
Conflict:NA
Reference:https://github.com/rsyslog/rsyslog/commit/2c8c9db065cef3b5086c90c3782ac48da40c8b2f
---
plugins/omkafka/omkafka.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/omkafka/omkafka.c b/plugins/omkafka/omkafka.c
index 850dfc0..e6cb2ea 100644
--- a/plugins/omkafka/omkafka.c
+++ b/plugins/omkafka/omkafka.c
@@ -350,6 +350,7 @@ const size_t msglen, const char *const topicname)
return NULL;
}
memcpy(etry->key, key, keylen);
+ etry->key[keylen] = '\0';
} else {
etry->key=NULL;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huyab/rsyslog.git
git@gitee.com:huyab/rsyslog.git
huyab
rsyslog
rsyslog
master

搜索帮助