代码拉取完成,页面将自动刷新
From f800fc88f6576c65fb8e4a3cce1c8f060e912c98 Mon Sep 17 00:00:00 2001
From: ticat_fp <fanpeng@loongson.cn>
Date: Tue, 5 Mar 2024 14:56:22 +0800
Subject: [PATCH 1/2] Always allocate a new pointer for section name that may
be freed.
Signed-off-by: cailulu <cailulu@loongson.cn>
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
---
bfd/peXXigen.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 14100b8a..2102928e 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -170,25 +170,25 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
int unused_section_number = 0;
asection *sec;
flagword flags;
+ size_t name_len;
+ char *sec_name;
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
unused_section_number = sec->target_index + 1;
- if (name == namebuf)
+ name_len = strlen (name) + 1;
+ sec_name = bfd_alloc (abfd, name_len);
+ if (sec_name == NULL)
{
- name = (const char *) bfd_alloc (abfd, strlen (namebuf) + 1);
- if (name == NULL)
- {
- _bfd_error_handler (_("%B: out of memory creating name for empty section"),
- abfd);
- return;
- }
- strcpy ((char *) name, namebuf);
+ _bfd_error_handler (_("%pB: out of memory creating name "
+ "for empty section"), abfd);
+ return;
}
+ memcpy (sec_name, name, name_len);
flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
- sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
+ sec = bfd_make_section_anyway_with_flags (abfd, sec_name, flags);
if (sec == NULL)
{
_bfd_error_handler (_("%B: unable to create fake empty section"),
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。