freedreno/cffdec: Fix format overflow warning.

../src/freedreno/decode/cffdec.c: In function ‘reg_disasm_gpuaddr’:
../src/freedreno/decode/cffdec.c:404:29: error: ‘sprintf’ writing a
terminating nul past the end of the destination [-Werror=format-overflow=]
  404 |   sprintf(filename, "%04d.%s", n++, ext);
../src/freedreno/decode/cffdec.c:404:3: note: ‘sprintf’ output between
9 and 16 bytes into a destination of size 8
  404 |   sprintf(filename, "%04d.%s", n++, ext);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
This commit is contained in:
Eric Anholt
2020-10-19 11:41:57 -07:00
committed by Marge Bot
parent e4dba528ca
commit 91c5bbc128

View File

@@ -399,7 +399,7 @@ dump_shader(const char *ext, void *buf, int bufsz)
{
if (options->dump_shaders) {
static int n = 0;
char filename[8];
char filename[16];
int fd;
sprintf(filename, "%04d.%s", n++, ext);
fd = open(filename, O_WRONLY| O_TRUNC | O_CREAT, 0644);