Repository navigation
fix argument quoting in win32_escape_dup for ippfind --exec - #212
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
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.
Trailing backslash escapes the closing quote in win32_escape_dup
On Windows,
ippfind --execquotes each argument withwin32_escape_dup()before_spawnvpe(), but a backslash at the end of a value is copied as-is, so the C runtime reads it plus the closing quote as a literal"and the argument never ends. Substituted values such as{service_name}and{txt_KEY}come from DNS-SD advertisements, so a printer on the local network can make the following argument split into extra argv entries. The rewrite follows the MSVCRT rule: N backslashes before a quote or the closing quote become 2N, and"is written as\".Repro (child prints the argv it receives), values
x\and--injected -o evil:The old code also turned
\\server\shareinto\\\\server\share. A round-trip harness over 310 fixed and random inputs (quotes, backslashes, spaces) fails on most of them before and passes all of them after, with ASan enabled. The change is inside#if _WIN32, so other platforms build the same code as before.