Add logic in routerparse to not read overlong private keys

I am not at all sure that it is possible to trigger a bug here,
but better safe than sorry.
This commit is contained in:
Nick Mathewson
2011-01-10 12:07:34 -05:00
parent 045e6ebd31
commit 729f404efe
4 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -3132,7 +3132,7 @@ get_next_token(memarea_t *area,
RET_ERR("Couldn't parse public key.");
} else if (!strcmp(tok->object_type, "RSA PRIVATE KEY")) { /* private key */
tok->key = crypto_new_pk_env();
if (crypto_pk_read_private_key_from_string(tok->key, obstart))
if (crypto_pk_read_private_key_from_string(tok->key, obstart, eol-obstart))
RET_ERR("Couldn't parse private key.");
} else { /* If it's something else, try to base64-decode it */
int r;