Skip to content

Remove the -Wno-stringop-overflow warning suppression#11355

Closed
freak82 wants to merge 2 commits into
apache:masterfrom
x3me:remove-no-stringop-overflow
Closed

Remove the -Wno-stringop-overflow warning suppression#11355
freak82 wants to merge 2 commits into
apache:masterfrom
x3me:remove-no-stringop-overflow

Conversation

@freak82
Copy link
Copy Markdown
Contributor

@freak82 freak82 commented May 15, 2024

The -Wstringop-overflow warning was caused by single usage of strncat function.
The problem was that GCC complained for possibly incorrect usage of strncat due to the last argument being equal to the source string length. The last argument of strncat is supposed to be the remaining free space in the destination buffer.
Replaced the usage of strncat with the ATS function ink_strlcat.
More info about this can be found in this ATS issue

freak82 added 2 commits May 15, 2024 09:48
The problem was that GCC complained for possibly incorrect usage of
strncat due to the last argument being equal to the source string length.
The last argument of strncat is supposed to be the remaining free space in
the destination buffer.
Replaced the usage of strncat with the ATS function ink_strlcat.
…spec*

The code was wrongly copying from timespec** to timespec*.
There was a warning emitted from GCC about this.
@freak82
Copy link
Copy Markdown
Contributor Author

freak82 commented May 15, 2024

I apologize for including the fix about the memcpy in src/iocore/net/UnixUDPNet.cc in this pull request.
I intended to do separate pull request for this change but ended up pushing the change in the same branch and thus it got into this pull request.
If needed I will close this pull request and do 2 separate ones.

#ifdef HAVE_SO_TXTIME
if (send_at_hint) {
memcpy(&p->p.send_at, &send_at_hint, sizeof(struct timespec));
memcpy(&p->p.send_at, send_at_hint, sizeof(struct timespec));
Copy link
Copy Markdown
Contributor

@brbzull0 brbzull0 May 15, 2024

Choose a reason for hiding this comment

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

Ohh!! this a very good catch.
Must have done some refactor before pushing this and let this slide!!

Please split this into a different PR just in case.
@freak82 thanks for finding and making a PR to fix this!!

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.

Ok. Will close this PR and make new ones.

@freak82 freak82 closed this May 15, 2024
@freak82 freak82 deleted the remove-no-stringop-overflow branch May 17, 2024 06:59
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