Permalink
Browse files

Make key file import robust against a PPK file that has somehow lost its

final newline. From Debian bug #414784, based on a patch by Justin Pryzby.


git-svn-id: svn://svn.tartarus.org/sgt/putty@8323 cda61777-01e9-0310-a592-d414129be87e
  • Loading branch information...
1 parent 95aec24 commit 37ec7a1124d00440401b81023260ff05bead4edf jacob committed Nov 23, 2008
Showing with 6 additions and 8 deletions.
  1. +6 −8 sshpubk.c
View
14 sshpubk.c
@@ -495,16 +495,14 @@ static char *read_body(FILE * fp)
while (1) {
c = fgetc(fp);
- if (c == '\r' || c == '\n') {
- c = fgetc(fp);
- if (c != '\r' && c != '\n' && c != EOF)
- ungetc(c, fp);
+ if (c == '\r' || c == '\n' || c == EOF) {
+ if (c != EOF) {
+ c = fgetc(fp);
+ if (c != '\r' && c != '\n')
+ ungetc(c, fp);
+ }
return text;
}
- if (c == EOF) {
- sfree(text);
- return NULL;
- }
if (len + 1 >= size) {
size += 128;
text = sresize(text, size, char);

0 comments on commit 37ec7a1

Please sign in to comment.