arduino-libraries / ArduinoMDNS

mDNS Library for Arduino
39 stars 13 forks source link

Bugs and issues #40

Closed matthewgream closed 1 hour ago

matthewgream commented 2 hours ago

There are a lot of issues in here, including useless code (e.g. "ptr" variable), inefficiencies (e.g. recordsAskedFor[1]) , and potential buffer overruns (on the checking for AAAA records) and no safety for malformed packets. Also the TXT encoding (in _sendMDNSMessage) is not RFC compliant. And the comparison on names is not case insensitive (in _matchStringPart). Also the use of an incoming buffer allocation on every single received packet (which includes packets that were not destined for this device) is extremely inefficient.

Here is a Light version for publish/announce/respond only, and not for outgoing browse/query/etc (as far as I can see, the stack does that) with a lot of these issues resolved and uses no incoming buffer allocation (other than what's already there in UDP).

https://gist.github.com/matthewgream/1c535fa86fd006ae794f4f245216b1a0

per1234 commented 1 hour ago

Hi @matthewgream. You are welcome to submit high quality formal bug reports for the defects you identified.

Please make sure to submit a separate issue for each distinct bug. Reporting multiple bugs in a single issue makes it too difficult for us to track them.