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

Fix buffer overflow #65

Merged
merged 1 commit into from
May 26, 2024
Merged

Fix buffer overflow #65

merged 1 commit into from
May 26, 2024

Conversation

jychen0611
Copy link
Collaborator

@jychen0611 jychen0611 commented May 24, 2024

When compiling, the following warning message is generated: "warning: ‘strncpy’ writing 1040 bytes into a region of size 1024 overflows the destination"
This is because calloc allocates NLMSG_SPACE(MAX_PAYLOAD) space for nlh, which includes the space for the header, so the actual space available for the message is only MAX_PAYLOAD.
@vax-r

When compiling, the following warning message is generated:
"warning: ‘strncpy’ writing 1040 bytes into a region of size
1024 overflows the destination"
This is because calloc allocates NLMSG_SPACE(MAX_PAYLOAD)
space for nlh, which includes the space for the header,
so the actual space available for the message is only
MAX_PAYLOAD.
@jserv jserv requested a review from rickywu0421 May 25, 2024 04:14
@vax-r
Copy link
Collaborator

vax-r commented May 26, 2024

Nice catch ! LGTM .

@jserv jserv merged commit c1ca07f into sysprog21:main May 26, 2024
4 checks passed
@jserv
Copy link
Contributor

jserv commented May 26, 2024

Thank @jychen0611 for contributing!

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.

3 participants