Fix src shift in ipp-file.c#1422
Closed
tsudik wants to merge 1 commit intoOpenPrinting:masterfrom
Closed
Conversation
Each case (`$$`, `$ENV[`, `${`, and plain `$`) is supposed to shift `src` after parsing. But the block responsible for the `$` case lacks this shift--it is located out of that block. So for the `${` case `src` is shifted twice: by `src += 2` and by `src += tempptr - temp + 1`, which results in `while (*src)` reading beyond the NUL-terminator.
michaelrsweet
requested changes
Nov 14, 2025
Member
michaelrsweet
left a comment
There was a problem hiding this comment.
OK, valid bug but I don't think your fix is correct since it doesn't advance "src" past the terminating '}' for an otherwise valid "${FOO}bar" - with your change "src" will point to the "F" instead of the "b".
I think we need to treat "${" without a terminating "}" to be an error.
michaelrsweet
added a commit
that referenced
this pull request
Nov 14, 2025
… better job
validating "$ENV[name]" and "${name}" expansions (Issue #1422)
Also update the documentation comments.
Member
|
OK, I made two sets of changes:
This addresses the general issue you reported and covers a few other edge cases as well. Let me know what you think: [master 051f63d] Return false if we have an unterminated quoted string token, and do a better job validating "$ENV[name]" and "${name}" expansions (Issue #1422) |
Author
|
Your solution is good. I agree with you. |
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.
Each case (
$$,$ENV[,${, and plain$) is supposed to shiftsrcafter parsing. But the block responsible for the$case lacks this shift--it is located out of that block. So for the${casesrcis shifted twice: bysrc += 2and bysrc += tempptr - temp + 1, which results inwhile (*src)reading beyond the NUL-terminator.run command:
test_file:
MSAN: