-
Notifications
You must be signed in to change notification settings - Fork 136
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
feat(mdns): add check of instance when handling PTR query (IDFGH-12701) #559
Conversation
5818615
to
6af6ca5
Compare
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
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
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
There was a problem hiding this 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.
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.
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.