support/kconfig: fix compiler warnings

Commit 324612d68e fixed several compiler warnings,
but actually introduced a new one by increasing the buffer size in confdata.c that gets passed
along to file_write_dep in util.c, because buf2's size wasn't increased along with it.

./util.c: In function ‘file_write_dep’:
./util.c:86:26: warning: ‘%s’ directive writing 10 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
   86 |         sprintf(buf2, "%s%s", dir, name);
      |                          ^~
./util.c:86:9: note: ‘sprintf’ output 11 or more bytes (assuming 4107) into a destination of size 4097
   86 |         sprintf(buf2, "%s%s", dir, name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by increasing the size of buf2 to match the passed buffer size.

Signed-off-by: Devreese Jorik <jorik.devreese@barco.com>
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Devreese Jorik
2026-05-07 14:35:34 +02:00
committed by Peter Korsgaard
parent 948f819d95
commit 1f5095c1d3

View File

@@ -35,7 +35,7 @@ struct file *file_lookup(const char *name)
int file_write_dep(const char *name)
{
char *str;
char buf[PATH_MAX+20], buf2[PATH_MAX+1], dir[PATH_MAX+1];
char buf[PATH_MAX+20], buf2[PATH_MAX+20], dir[PATH_MAX+1];
struct symbol *sym, *env_sym;
struct expr *e;
struct file *file;