Skip to content

Fix: Cap DNS answer loop iterations to prevent DoS#1329

Open
felicityzhao9 wants to merge 2 commits intoFreeRTOS:mainfrom
felicityzhao9:limit-answers
Open

Fix: Cap DNS answer loop iterations to prevent DoS#1329
felicityzhao9 wants to merge 2 commits intoFreeRTOS:mainfrom
felicityzhao9:limit-answers

Conversation

@felicityzhao9
Copy link
Copy Markdown
Member

Description

In the current implementation, the loop iterates up to pxSet->usAnswers, which is derived directly from the packet header. The early-exit condition depends on usNumARecordsStored reaching ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY, but this counter is only incremented when pxSet->xDoStore != pdFALSE. As a result, for unexpected replies, the counter never increases and the loop may continue iterating over all advertised answers and potentially perform excessive work.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant