120 Star 1 Fork 11

src-openEuler/pinfo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pinfo-0.6.13-stringop-overflow.patch 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
starlet_dx 提交于 2023-10-08 16:23 . Upgrade to 0.6.13
From 23c169877fda839f0634b2d193eaf26de290f141 Mon Sep 17 00:00:00 2001
From: Bas Zoetekouw <[email protected]>
Date: Thu, 23 Jul 2020 20:39:04 +0200
Subject: [PATCH] workaround false positie in gcc-10 stringop-overflow checks
---
src/utils.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/utils.c b/src/utils.c
index cb2fe76..2e4139c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -848,10 +848,9 @@ char *
make_tempfile()
{
char *filename;
- size_t len;
/* TODO: fix hardcoded /tmp */
- char tmpfile_template[] = "/tmp/pinfo.XXXXXX";
+ char tmpfile_template[32] = "/tmp/pinfo.XXXXXX";
/* create a tmpfile */
int fd = mkstemp(tmpfile_template);
@@ -864,9 +863,8 @@ make_tempfile()
}
/* allocate a new string and copy the filename there */
- len = strlen(tmpfile_template)+1;
- filename = xmalloc(len+1); /* guarenteerd to be set to \0's */
- strncpy(filename, tmpfile_template, len);
+ filename = xmalloc(33); /* guarenteerd to be set to \0's */
+ strncpy(filename, tmpfile_template, 32);
/* close the file */
close(fd);
--
2.39.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/pinfo.git
[email protected]:src-openeuler/pinfo.git
src-openeuler
pinfo
pinfo
master

搜索帮助