Repository navigation
dnssd.c: reject oversized TXT record sets in cupsDNSSDServiceAdd() on Windows - #228
Open
ManasBagul23 wants to merge 1 commit into
Open
ManasBagul23 wants to merge 1 commit into
ManasBagul23 wants to merge 1 commit into
Conversation
… Windows The WinDNS backend builds the key/value pointer arrays passed to DnsServiceConstructInstance() into fixed 256-entry stack arrays (keys[256], values[256]), but never checked the caller-supplied num_txt count against that limit before writing keys[j]/values[j] for every entry. A caller registering a service with more than 256 TXT key/value pairs overflows both stack arrays. Reject the request up front instead, matching this function's existing error-reporting convention.
This branch has not been deployed
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.
Summary
On the Windows (WinDNS) backend,
cupsDNSSDServiceAdd()builds the key/value pointer arrays it passes toDnsServiceConstructInstance()into fixed 256-entry stack arrays (keys[256],values[256]), but never checks the caller-suppliednum_txtagainst that limit before writingkeys[j]/values[j]for every entry in the loop that fills them.Fix
Reject the call up front if
num_txtexceeds the array size, the same way this function already rejects other invalid states (report_error()+ret = false+goto done;).Test plan
cupsDNSSDServiceAdd()withnum_txt <= 256behaves unchanged.cupsDNSSDServiceAdd()called withnum_txt > 256now returnsfalseand reports "Too many TXT record key/value pairs." instead of overflowing the stack arrays.