gcc10-stringop.diff 773 B

1234567891011121314151617181920212223242526272829
  1. diff --git a/src/utils.c b/src/utils.c
  2. index cb2fe76..2e4139c 100644
  3. --- a/src/utils.c
  4. +++ b/src/utils.c
  5. @@ -848,10 +848,9 @@ char *
  6. make_tempfile()
  7. {
  8. char *filename;
  9. - size_t len;
  10. /* TODO: fix hardcoded /tmp */
  11. - char tmpfile_template[] = "/tmp/pinfo.XXXXXX";
  12. + char tmpfile_template[32] = "/tmp/pinfo.XXXXXX";
  13. /* create a tmpfile */
  14. int fd = mkstemp(tmpfile_template);
  15. @@ -864,9 +863,8 @@ make_tempfile()
  16. }
  17. /* allocate a new string and copy the filename there */
  18. - len = strlen(tmpfile_template)+1;
  19. - filename = xmalloc(len+1); /* guarenteerd to be set to \0's */
  20. - strncpy(filename, tmpfile_template, len);
  21. + filename = xmalloc(33); /* guarenteerd to be set to \0's */
  22. + strncpy(filename, tmpfile_template, 32);
  23. /* close the file */
  24. close(fd);