Skip to content

Fix error: '%s' directive output may be truncated#10160

Closed
xiaoxiang781216 wants to merge 1 commit intoapache:masterfrom
xiaoxiang781216:fix
Closed

Fix error: '%s' directive output may be truncated#10160
xiaoxiang781216 wants to merge 1 commit intoapache:masterfrom
xiaoxiang781216:fix

Conversation

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

Summary

writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=]

Impact

Testing

ci

writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Comment thread drivers/ioexpander/gpio.c
FAR const char *pinname)
{
char devname[32];
char devname[64];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see how this should help. Maybe snprintf(devname, sizeof(devname) - 5, "/dev/%s", pinname); instead or snprintf(devname, sizeof(devname) - sizeof("/dev/") - 1, "/dev/%s", pinname);?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the problem is fixed here: #8658. Let's close this PR.

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.

2 participants