1 Star 0 Fork 21

BridgeNorth/tcl

forked from src-openEuler/tcl 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Improved-overflow-prevention-2.patch 779 Bytes
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:18 . Package init
From 183dadc7fae0994a33901a7246989d2605f5c70c Mon Sep 17 00:00:00 2001
From: dgp <dgp@users.sourceforge.net>
Date: Mon, 5 Feb 2018 13:41:26 +0000
Subject: [PATCH 0879/1800] Improved overflow prevention.
---
generic/tclStringObj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 8437555ed..c3a0192d8 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -190,8 +190,8 @@ GrowUnicodeBuffer(
* Subsequent appends - apply the growth algorithm.
*/
- attempt = 2 * needed;
- if (attempt >= 0 && attempt <= STRING_MAXCHARS) {
+ if (needed <= STRING_MAXCHARS / 2) {
+ attempt = 2 * needed;
ptr = stringAttemptRealloc(stringPtr, attempt);
}
if (ptr == NULL) {
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/run-is-pig/tcl.git
git@gitee.com:run-is-pig/tcl.git
run-is-pig
tcl
tcl
master

搜索帮助