]> git.meshlink.io Git - meshlink/blobdiff - src/protocol_key.c
Prevent possible buffer overflows when using very large (>= 8192 bit) RSA keys.
[meshlink] / src / protocol_key.c
index a56ff919df8d1de88b718d502bf6e7c01bc8357a..e393dd64a945216ce28a36b2dbe88661e9678e18 100644 (file)
@@ -142,10 +142,11 @@ bool req_key_h(connection_t *c)
 
 bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
 {
-       char key[MAX_STRING_SIZE];
+       char *key;
 
        cp();
 
+       key = alloca(2 * from->keylength + 1);
        bin2hex(from->key, key, from->keylength);
        key[from->keylength * 2] = '\0';