]> git.pld-linux.org Git - packages/pinfo.git/blobdiff - pinfo-truncation-workaround.patch
- added truncation-workaround patch to workaround build failure on th-i686; release 2
[packages/pinfo.git] / pinfo-truncation-workaround.patch
diff --git a/pinfo-truncation-workaround.patch b/pinfo-truncation-workaround.patch
new file mode 100644 (file)
index 0000000..551d846
--- /dev/null
@@ -0,0 +1,26 @@
+gcc's -Werror=stringop-truncation tries to be too smart, but actually it isn't.
+Take len just after initialization, before call to mkstemp() (which doesn't change string length);
+now gcc doesn't complain.
+
+--- pinfo-0.6.13/src/utils.c.orig      2019-02-16 21:23:32.000000000 +0100
++++ pinfo-0.6.13/src/utils.c   2021-10-03 07:45:00.428038370 +0200
+@@ -848,10 +848,10 @@ char *
+ make_tempfile()
+ {
+       char *filename;
+-      size_t len;
+       /* TODO: fix hardcoded /tmp */
+       char tmpfile_template[] = "/tmp/pinfo.XXXXXX";
++      size_t len = strlen(tmpfile_template)+1;
+       /* create a tmpfile */
+       int fd = mkstemp(tmpfile_template);
+@@ -864,7 +864,6 @@ 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);
This page took 0.079366 seconds and 4 git commands to generate.