summaryrefslogtreecommitdiff
path: root/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'key.c')
-rw-r--r--key.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/key.c b/key.c
index ae355a3fc..d474f85c6 100644
--- a/key.c
+++ b/key.c
@@ -256,12 +256,14 @@ key_read(Key *ret, char **cpp)
256 blob = xmalloc(len); 256 blob = xmalloc(len);
257 n = uudecode(cp, blob, len); 257 n = uudecode(cp, blob, len);
258 if (n < 0) { 258 if (n < 0) {
259 error("uudecode %s failed", cp); 259 error("key_read: uudecode %s failed", cp);
260 return 0; 260 return 0;
261 } 261 }
262 k = dsa_key_from_blob(blob, n); 262 k = dsa_key_from_blob(blob, n);
263 if (k == NULL) 263 if (k == NULL) {
264 return 0; 264 error("key_read: dsa_key_from_blob %s failed", cp);
265 return 0;
266 }
265 xfree(blob); 267 xfree(blob);
266 if (ret->dsa != NULL) 268 if (ret->dsa != NULL)
267 DSA_free(ret->dsa); 269 DSA_free(ret->dsa);
@@ -269,10 +271,12 @@ key_read(Key *ret, char **cpp)
269 k->dsa = NULL; 271 k->dsa = NULL;
270 key_free(k); 272 key_free(k);
271 bits = BN_num_bits(ret->dsa->p); 273 bits = BN_num_bits(ret->dsa->p);
272 cp = strchr(cp, '='); 274 /* advance cp: skip whitespace and data */
273 if (cp == NULL) 275 while (*cp == ' ' || *cp == '\t')
274 return 0; 276 cp++;
275 *cpp = cp + 1; 277 while (*cp != '\0' && *cp != ' ' && *cp != '\t')
278 cp++;
279 *cpp = cp;
276 break; 280 break;
277 default: 281 default:
278 fatal("key_read: bad key type: %d", ret->type); 282 fatal("key_read: bad key type: %d", ret->type);