| Summary: | ssh-keyscan doesn't like comment-lines | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Martin Schuster <schuster> | ||||||||||||
| Component: | Miscellaneous | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||||||||
| Status: | CLOSED FIXED | ||||||||||||||
| Severity: | minor | CC: | djm, dtucker, joachim | ||||||||||||
| Priority: | P2 | Keywords: | low-hanging-fruit | ||||||||||||
| Version: | 5.1p1 | ||||||||||||||
| Hardware: | All | ||||||||||||||
| OS: | Linux | ||||||||||||||
| Bug Depends on: | |||||||||||||||
| Bug Blocks: | 1708 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Martin Schuster
2009-03-04 20:00:19 AEDT
Created attachment 1806 [details]
Patch to fix integer overflow in fgets() wrapper
As described in http://mid.gmane.org/20100306210548.GA32662@polymnia.sshunet.nl, ssh-keyscan may suffer an integer overflow when run on a file with ridiculously (> 2GB) long lines. The attached patch fixes this and also allows comments. Created attachment 1868 [details]
/home/djm/keyscan-uncrazy.diff
use read_keyfile_line()\n\nWe already have a fgets() wrapper, let's use it.
Created attachment 1869 [details]
/home/djm/keyscan-uncrazy.diff
revised diff
Comment on attachment 1869 [details]
/home/djm/keyscan-uncrazy.diff
ugh, attached the wrong diff twice :(
Created attachment 1870 [details]
/home/djm/keyscan-uncrazy.diff
The original diff didn't correctly handle the case of "ssh-keyscan -f -" (it would SEGV or EINVAL on fopen). This one uses our existing wrapper for fgets().
Created attachment 1875 [details]
Patch to fix ssh-keyscan
The attached patch is a slight alteration of your (Damien's) patch.
- these lines are not related to SSH_MAX_PUBKEY_BYTES, so just hardcode some reasonable value;
- linenum should be per-file, not over all files;
- fatal() on long lines instead of silently ignoring them.
(In reply to comment #7) > Created attachment 1875 [details] > Patch to fix ssh-keyscan > > The attached patch is a slight alteration of your (Damien's) patch. > > - these lines are not related to SSH_MAX_PUBKEY_BYTES, so just hardcode > some reasonable value; > - linenum should be per-file, not over all files; These are both valid points. > - fatal() on long lines instead of silently ignoring them. This one I don't care so much about. I agree with Darren. The corresponding patch has been committed and will be in OpenSSH-5.6. Thanks! Move resolved bugs to CLOSED after 5.7 release |