1 Star 0 Fork 15

mc964203886/net-snmp

forked from src-openEuler/net-snmp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libsnmp-Fix-undefined-behavior-in-asn_build_int.patch 1001 Bytes
一键复制 编辑 原始数据 按行查看 历史
dowzyx 提交于 2021-09-17 08:55 . fix memory leak
From 277d75633d8008cde468d026694289ca32f2cb6d Mon Sep 17 00:00:00 2001
From: Bart Van Assche <bvanassche@acm.org>
Date: Thu, 26 Aug 2021 10:17:11 -0700
Subject: [PATCH] libsnmp: Fix undefined behavior in asn_build_int()
According to the C standard, triggering an overflow by shifting a signed
integer results in undefined behavior. Fix this by inserting a cast.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37579
---
snmplib/asn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/snmplib/asn1.c b/snmplib/asn1.c
index d5d7eb6..959ae21 100644
--- a/snmplib/asn1.c
+++ b/snmplib/asn1.c
@@ -784,7 +784,7 @@ asn_build_int(u_char * data,
*/
while (intsize--) {
*data++ = (u_char) ((integer & mask) >> (8 * (sizeof(long) - 1)));
- integer <<= 8;
+ integer = (u_long)integer << 8;
}
DEBUGDUMPSETUP("send", initdatap, data - initdatap);
DEBUGMSG(("dumpv_send", " Integer:\t%ld (0x%.2lX)\n", *intp, *intp));
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mc964203886/net-snmp.git
git@gitee.com:mc964203886/net-snmp.git
mc964203886
net-snmp
net-snmp
master

搜索帮助