pinfo/pinfo-0.6.13-stringop-overflow.patch
2023-01-26 10:41:36 +01:00

41 lines
1.1 KiB
Diff

From 23c169877fda839f0634b2d193eaf26de290f141 Mon Sep 17 00:00:00 2001
From: Bas Zoetekouw <bas.zoetekouw@surfnet.nl>
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