Open
Conversation
Collaborator
Author
Diebbo
commented
Feb 24, 2025
| memcpy(&decompressed_name[decompressed_index], label, label_size); | ||
| decompressed_index = (uint16_t)(decompressed_index+label_size); | ||
| } | ||
| char *pico_dns_decompress_name(char *name, pico_dns_packet *packet) { |
Collaborator
Author
There was a problem hiding this comment.
function presenting vulns
Closed
scribam
reviewed
Nov 15, 2025
| for (i = 0; i < vector->count; i++) { | ||
| iterator = pico_dns_sd_kv_vector_get(vector, i); | ||
|
|
||
| if (!iterator || iterator->key){ |
Collaborator
There was a problem hiding this comment.
@Diebbo Did you mean?
Suggested change
| if (!iterator || iterator->key){ | |
| if (!iterator || !iterator->key){ |
scribam
reviewed
Nov 15, 2025
| * Only one pointer is allowed in DNS compression, the pointer is always the | ||
| * last according to the RFC */ | ||
| dns_name_foreach_label_safe(label, name, next, PICO_DNS_NAMEBUF_SIZE) { | ||
| if (!label || (*label & 0xFF) >= PICO_DNS_NAMEBUF_SIZE) { |
Collaborator
There was a problem hiding this comment.
@Diebbo Are these checks necessary?
nameis not a NULL pointer (with your previously added check) solabelwill not be a NULL pointer as well (at least, at the beginning of the loop)- Macro
dns_name_foreach_label_safeensures*label <= 63so, to me,(*label & 0xFF) >= PICO_DNS_NAMEBUF_SIZE)will be always false
Let me know if I missed something or if you have an example that makes these checks relevant
This was referenced Nov 29, 2025
Closed
scribam
reviewed
Dec 13, 2025
| decompressed_index = (uint16_t)(decompressed_index+label_size); | ||
| } | ||
| char *pico_dns_decompress_name(char *name, pico_dns_packet *packet) { | ||
| uint16_t packet_len = sizeof(pico_dns_packet); |
Collaborator
There was a problem hiding this comment.
This is wrong as it does not represent the whole size of the packet but a fixed size corresponding to the size of the dns header (12).
scribam
reviewed
Dec 13, 2025
| ptr = (uint16_t)(ptr | (uint16_t)*(label + 1)); | ||
|
|
||
| /* Check if the pointer is within the packet */ | ||
| if (ptr >= packet_len) { |
Collaborator
There was a problem hiding this comment.
Unit test "tc_mdns_handle_data_as_questions" fails here because there is compression pointer with an offset >= 12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.