mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
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. [originally from svn r8323]
This commit is contained in:
parent
7da40ece76
commit
c9326ad81b
14
sshpubk.c
14
sshpubk.c
@ -495,16 +495,14 @@ static char *read_body(FILE * fp)
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
c = fgetc(fp);
|
c = fgetc(fp);
|
||||||
if (c == '\r' || c == '\n') {
|
if (c == '\r' || c == '\n' || c == EOF) {
|
||||||
c = fgetc(fp);
|
if (c != EOF) {
|
||||||
if (c != '\r' && c != '\n' && c != EOF)
|
c = fgetc(fp);
|
||||||
ungetc(c, fp);
|
if (c != '\r' && c != '\n')
|
||||||
|
ungetc(c, fp);
|
||||||
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
if (c == EOF) {
|
|
||||||
sfree(text);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (len + 1 >= size) {
|
if (len + 1 >= size) {
|
||||||
size += 128;
|
size += 128;
|
||||||
text = sresize(text, size, char);
|
text = sresize(text, size, char);
|
||||||
|
Loading…
Reference in New Issue
Block a user