From 91c5bbc128b13e14ecccd06d6004c364bc2ebc6e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2020 11:41:57 -0700 Subject: [PATCH] freedreno/cffdec: Fix format overflow warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../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: --- src/freedreno/decode/cffdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/freedreno/decode/cffdec.c b/src/freedreno/decode/cffdec.c index ed9537a4fd0..10b27b0a236 100644 --- a/src/freedreno/decode/cffdec.c +++ b/src/freedreno/decode/cffdec.c @@ -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);