Skip to content

Conversation

@jamesjer
Copy link
Contributor

GCC sees that an int will be written into service and knows that writing -2147483647 takes 12 bytes, so it warns that the sprintf call may overflow the 10 byte buffer. We know that port numbers don't cover the entire range of values of the int type, so the code is not really wrong. This patch is purely to make gcc be quiet.

Note that on modern CPU architectures, either 12 or 16 bytes will be allocated anyway, for alignment reasons, so this change doesn't increase stack usage.

@manuel-serrano manuel-serrano merged commit 4a1de65 into manuel-serrano:master Jan 28, 2026
1 check passed
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