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

Handle malloc failure in dns setcallback #1155

Conversation

tony-josi-aws
Copy link
Member

Description

This PR handles malloc failure while allocating memory for DNS callback in vDNSSetCallBack API.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@tony-josi-aws tony-josi-aws requested a review from a team as a code owner June 12, 2024 13:20
chinglee-iot
chinglee-iot previously approved these changes Jun 14, 2024
shubnil
shubnil previously approved these changes Jun 14, 2024
Copy link
Member

@shubnil shubnil left a comment

Choose a reason for hiding this comment

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

This PR looks good, however there are some places where the strcpy is not doing a size check and as the source pointers are coming from application there is a potential schenario where out of buffer copy can happen. Please check if we can create a new PR for the same.

{
BaseType_t xReturn = pdPASS;
Copy link
Member

Choose a reason for hiding this comment

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

  • Can the strcpy in line 158 cause a copy overflow. We can use strncpy instead or put a size check as the destination is a fixed array

@tony-josi-aws tony-josi-aws dismissed stale reviews from shubnil and chinglee-iot via f0375bf June 14, 2024 10:43
@tony-josi-aws tony-josi-aws merged commit 0c8210f into FreeRTOS:main Jun 17, 2024
10 checks 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.

3 participants