summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-01-10 12:07:34 -0500
committerNick Mathewson <nickm@torproject.org>2011-01-10 12:07:34 -0500
commit729f404efec0795f7ed358e7b2fa08bd62cc1ae8 (patch)
tree73f2ec66d98c01be77b885735ee67f45bb8dc6c6 /src/or/routerparse.c
parent045e6ebd315db635ea80796469891bab33d1d6be (diff)
downloadtor-729f404efec0795f7ed358e7b2fa08bd62cc1ae8.tar.gz
tor-729f404efec0795f7ed358e7b2fa08bd62cc1ae8.zip
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.
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index fc30c625bf..6ca2293375 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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;