ccan icon indicating copy to clipboard operation
ccan copied to clipboard

ccan/ciniparser: fix truncation warning

Open johanmalm opened this issue 7 months ago • 2 comments

Increase size of tmp buffer to avoid warning:

ninja: Entering directory `build'
[1/2] Compiling C object trappist.p/ccan_ccan_ciniparser_ciniparser.c.o
../ccan/ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
../ccan/ccan/ciniparser/ciniparser.c:443:56: warning: ‘%s’ directive output may be truncated writing up to 1024 bytes into a region of size between 0 and 1024 [-Wformat-truncation=]
  443 |                         snprintf(tmp, sizeof(tmp), "%s:%s", section, key);
      |                                                        ^~            ~~~
../ccan/ccan/ciniparser/ciniparser.c:443:25: note: ‘snprintf’ output between 2 and 2050 bytes into a destination of size 1025
  443 |                         snprintf(tmp, sizeof(tmp), "%s:%s", section, key);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2/2] Linking target trappist

johanmalm avatar Jul 09 '24 21:07 johanmalm