| Summary: | New OpenSSH fails to parse public keys with bogus whitespace | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Jakub Jelen <jjelen> | ||||||
| Component: | sshd | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | enhancement | CC: | djm, dtucker | ||||||
| Priority: | P5 | ||||||||
| Version: | 7.5p1 | ||||||||
| Hardware: | Other | ||||||||
| OS: | Linux | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 2782 | ||||||||
| Attachments: |
|
||||||||
|
Description
Jakub Jelen
2017-09-28 00:54:32 AEST
Created attachment 3128 [details]
refactor sshkey_read, allow more whitespace
IMO sshkey_read() needs a more comprehensive refactor since it's quite crufty and internally inconsistent, especially in how it allowed tab characters in some places and not others.
This moves the big switch statement to the start of the function; it was previously used to select v1/v2 key parsing but now only functions as a test of key->type. Moving it allows the the whole function to be outdented.
It switches from strchr to strcspn to find spaces, and now accepts tabs anywhere where whitespace is allowed.
Finally, it no longer modifies its argument during parsing but I'll commit the flipping of its argument to const until later to avoid colliding other in-progress diffs.
This is committed and will be in 7.7 closing resolved bugs as of 8.6p1 release |