1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38: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:
Jacob Nevins 2008-11-23 20:11:12 +00:00
parent 7da40ece76
commit c9326ad81b

View File

@ -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);