bounds-check dns response parsing against packet end#1628
Conversation
|
Thank you for the PR.
I drafted an alternative solution. You can see that as a comparison with the current Moddable SDK version in this gist. |
|
you're right on all three. the refresh optimization is the real bug: centralizing the your draft covers everything mine does plus the header case. happy to defer to it. want me to push it to this branch, or will you land it directly? |
|
Thanks for reviewing. If you want to update the PR, that would be fine. You started the effort. |
6bb1f66 to
5c77000
Compare
|
pushed your draft to the branch, squashed into the one commit so the diff stays just the bounds checks. the |
parseQnamefollows a compression pointer and copies label bytes with no packet-end check, and theTXTloop inparseQuestionOrAnswerunderflowsrdlengthwhen a sub-string length exceeds it, so a malformed DNS response read from the resolver's UDP socket reads past the packet buffer.