-
Notifications
You must be signed in to change notification settings - Fork 269
Control character check #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+7
−4
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you - though please,
so basically
Thanks again! (and please let me know if you prefer I do this inline - I don't want it to get needlessly tedious for you)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. :) I did it this way because I didn’t think you wanted to ban non-printables also because that will break support for a lot of special characters in names? Your change makes this -1 and therefore non-printables will no longer be supported whereas currently this is permitted and returns 1. Can you just clarify you want to ban both? Banning control characters should be sufficient to stop the poc discussed, without impacting use cases still. I've made the change but let me know if this wasn't intended! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - you're right, my proposal is wrong. We should not switch to returning -1 instead of 1 for non-printables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Let me re-open this old thread. I was revising the source code in this file, and the git-blame(1) led me to this patch, and the patch to this PR.
This patch doesn't look good (even ignoring the bug that was accidentally introduced, which was later fixed by @cgzones ): All ASCII characters are either isprint or iscntrl, but not both. See below.
We should revert this patch, for clarity. I'm preparing a round of patches.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, the return value of 1 was completely being ignored in most calls, checking explicitly against
-1, so we're better with this -1.I'll reform this function to only report -1 or 0.
In fact, we're already only returning 0 or -1. 1 can never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, multi-byte sequences did actually return 1, so maybe we do want to keep allowing them by returning 1 for them. Since this function is called on the gecos field, that would make sense.
In that case, the current code is good, but confusing. I'll see what I can do.