Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccan/ciniparser: fix truncation warning #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanmalm
Copy link

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

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
```

Signed-off-by: Johan Malm <[email protected]>
@dgibson dgibson assigned dgibson and rustyrussell and unassigned dgibson Jul 15, 2024
@dgibson
Copy link
Collaborator

dgibson commented Jul 15, 2024

/cc @bradh

@bradh
Copy link
Contributor

bradh commented Jul 15, 2024

Not sure this is one of mine...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants