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

feat(mdns): add check of instance when handling PTR query (IDFGH-12701) #559

Conversation

gytxxsy
Copy link
Contributor

@gytxxsy gytxxsy commented Apr 25, 2024

  1. Upon receiving a PTR query, when matching question and answer entries, if an instance exists in the answer entry, it will also be considered as one of the check items. This change is to avoid mistakenly deleting certain question entries. For example, if device A hosts services B with the different instances (ins1~ins5). When the device receives a PTR query, with the question querying service B, and the answer list already contains ins1.Service B and ins2.Service B, then when matching this question entry and answer entries, the question entry should not be deleted.

  2. Check the answer entries in the query when creating answer entries for query response. If the answer entry already exists, then give up creating that entry.

@gytxxsy
Copy link
Contributor Author

gytxxsy commented Apr 25, 2024

@zwx1995esp @chshu

@github-actions github-actions bot changed the title feat(mdns): add check of instance when handling PTR query feat(mdns): add check of instance when handling PTR query (IDFGH-12701) Apr 25, 2024
@gabsuren gabsuren added the mdns label Apr 25, 2024
@gabsuren gabsuren requested review from gabsuren and david-cermak May 24, 2024 11:34
@gytxxsy gytxxsy force-pushed the feature/add_instance_check_for_existing_answer branch from 5818615 to 6af6ca5 Compare May 31, 2024 09:29
HOOK_MALLOC_FAILED;
goto clear_rx_packet;
}
memcpy(record->host, name->host, MDNS_NAME_BUF_LEN);

Check warning

Code scanning / clang-tidy

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
HOOK_MALLOC_FAILED;
goto clear_rx_packet;
}
memcpy(record->service, name->service, MDNS_NAME_BUF_LEN);

Check warning

Code scanning / clang-tidy

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
HOOK_MALLOC_FAILED;
goto clear_rx_packet;
}
memcpy(record->proto, name->proto, MDNS_NAME_BUF_LEN);

Check warning

Code scanning / clang-tidy

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
Copy link
Collaborator

@david-cermak david-cermak left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM.

you can ignore the clang warnings on memcpy() for now -- we'd have to address it globally, later.

@gabsuren gabsuren merged commit d20255a into espressif:master Jun 3, 2024
43 of 44 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.

4 participants