代码拉取完成,页面将自动刷新
From 23882383d45dcd37b5177835c873f4e1d9582db1 Mon Sep 17 00:00:00 2001
From: Explorer09 <explorer09@gmail.com>
Date: Fri, 13 Oct 2017 16:59:26 +0800
Subject: [PATCH] scanner: prevent overflow in add_action()
---
src/misc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/misc.c b/src/misc.c
index fa33a5b..745e6a8 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -116,15 +116,14 @@ void add_action (const char *new_text)
int len = (int) strlen (new_text);
while (len + action_index >= action_size - 10 /* slop */ ) {
- int new_size = action_size * 2;
- if (new_size <= 0)
+ if (action_size > INT_MAX / 2)
/* Increase just a little, to try to avoid overflow
* on 16-bit machines.
*/
action_size += action_size / 8;
else
- action_size = new_size;
+ action_size = action_size * 2;
action_array =
reallocate_character_array (action_array,
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。