Repository navigation
libcups2: stop ppd_unquote() reading past a trailing backslash - #115
Merged
tillkamppeter merged 1 commit intoNov 21, 2026
Conversation
ppd_unquote() unescapes a .po/.strings value in place. When a value ends in a literal backslash just before the closing quote (the caller already stripped that quote and NUL-terminated the string there), the function advances past the backslash with "s++" and immediately dereferences *s again without checking whether that landed on the terminating NUL. Since there is nothing past the NUL for a value that ends right there, this reads one byte past the end of the string's allocation; reproduced a crash by placing such a string so its NUL lands on the last byte of a mapped page, with the next page unreadable. Stop and leave the backslash as the end of output if nothing follows it, instead of reading past the string.
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
`ppd_unquote()` unescapes a `.po`/`.strings` value in place.
The bug
When a value ends in a literal backslash just before the closing quote (the caller already stripped that quote and NUL-terminated the string there), the function advances past the backslash with `s++` and immediately dereferences `*s` again without checking whether that landed on the terminating NUL. Since there is nothing past the NUL for a value that ends right there, this reads one byte past the end of the string's allocation.
Fix
Stop and leave the backslash as the end of output if nothing follows it, instead of reading past the string.
Test plan