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.
The character buffer protoName, created on the stack in the function MDNSResponder::_parsePacket(), is uninitialized. It can remain uninitialized all the way to the bottom of that function, where it is passed to the function MDNSResponder::_reply.
In MDNSResponder::_reply, the pointer passed in is named 'proto'. You will will find these lines of code near the top of that function...
You can see there that if proto points to an uninitialized character buffer on the stack, the strcat call can blow way the stack.
I was getting random crashes when a client tried to connect to my esp8266 server using the 'server.local' host name. Those crashes have disappeared since I made this change.
Oh... one more thing... I changed a few memcpy to memmove calls where the source and destination overlap. Not sure that was causing a problem, but I believe memcpy does not guarantee correct results if the source and destination overlap.