diff options
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r-- | ssh-keygen.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c index a2599dab9..351036dd4 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$Id: ssh-keygen.c,v 1.17 2000/05/07 02:03:19 damien Exp $"); | 10 | RCSID("$Id: ssh-keygen.c,v 1.18 2000/05/09 01:03:02 damien Exp $"); |
11 | 11 | ||
12 | #include <openssl/evp.h> | 12 | #include <openssl/evp.h> |
13 | #include <openssl/pem.h> | 13 | #include <openssl/pem.h> |
@@ -148,6 +148,7 @@ do_convert_from_ssh2(struct passwd *pw) | |||
148 | char blob[8096]; | 148 | char blob[8096]; |
149 | char encoded[8096]; | 149 | char encoded[8096]; |
150 | struct stat st; | 150 | struct stat st; |
151 | int escaped = 0; | ||
151 | FILE *fp; | 152 | FILE *fp; |
152 | 153 | ||
153 | if (!have_identity) | 154 | if (!have_identity) |
@@ -163,14 +164,21 @@ do_convert_from_ssh2(struct passwd *pw) | |||
163 | } | 164 | } |
164 | encoded[0] = '\0'; | 165 | encoded[0] = '\0'; |
165 | while (fgets(line, sizeof(line), fp)) { | 166 | while (fgets(line, sizeof(line), fp)) { |
167 | if (!(p = strchr(line, '\n'))) { | ||
168 | fprintf(stderr, "input line too long.\n"); | ||
169 | exit(1); | ||
170 | } | ||
171 | if (p > line && p[-1] == '\\') | ||
172 | escaped++; | ||
166 | if (strncmp(line, "----", 4) == 0 || | 173 | if (strncmp(line, "----", 4) == 0 || |
167 | strstr(line, ": ") != NULL) { | 174 | strstr(line, ": ") != NULL) { |
168 | fprintf(stderr, "ignore: %s", line); | 175 | fprintf(stderr, "ignore: %s", line); |
169 | continue; | 176 | continue; |
170 | } | 177 | } |
171 | if (!(p = strchr(line, '\n'))) { | 178 | if (escaped) { |
172 | fprintf(stderr, "input line too long.\n"); | 179 | escaped--; |
173 | exit(1); | 180 | fprintf(stderr, "escaped: %s", line); |
181 | continue; | ||
174 | } | 182 | } |
175 | *p = '\0'; | 183 | *p = '\0'; |
176 | strlcat(encoded, line, sizeof(encoded)); | 184 | strlcat(encoded, line, sizeof(encoded)); |