fix out-of-bounds write for long -default names in _cupsGetDests - #1694
Closed
aizu-m wants to merge 1 commit into
Closed
fix out-of-bounds write for long -default names in _cupsGetDests#1694aizu-m wants to merge 1 commit into
aizu-m wants to merge 1 commit into
Conversation
Member
|
Seems like the correct fix here is to ensure that the IPP message parser correctly limits IPP attribute names to a maximum of 255 bytes/octets. |
michaelrsweet
added a commit
that referenced
this pull request
Sep 9, 2026
michaelrsweet
added a commit
that referenced
this pull request
Sep 9, 2026
Member
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.
AddressSanitizer, running the
_cupsGetDests()attribute loop over one printer attribute named 1030×Afollowed by-default:optnameis a 1024-byte buffer.cupsCopyString()truncates the name into it safely, then the next line terminates it atoptname[ptr - attr->name], whereptr = strstr(attr->name, "-default")was taken from the full name. The IPP reader only caps an attribute name atIPP_BUF_SIZE(32767) bytes, so a hostileGet-Printer-Attributesresponse can carry a name of a few thousand characters ending in-default; the stray NUL then lands well pastoptname, on the stack frame.The offset comes from the untruncated source while the write target is the truncated copy. Locating
-defaultinoptnameitself keeps the write in bounds. Normal names are terminated at the same place, so output is unchanged.Reached by any client that enumerates printers from an untrusted server, i.e.
cupsGetDests/cupsGetNamedDest/cupsEnumDestsviaCUPS_SERVERor a driverless printer answering discovery.