Use variable length arrays instead of alloca().

This commit is contained in:
Guus Sliepen 2010-11-13 15:55:38 +01:00
parent e2e6ec8050
commit 9e3ca39773
3 changed files with 6 additions and 13 deletions

View file

@ -145,8 +145,6 @@ bool req_key_h(connection_t *c) {
}
bool send_ans_key(node_t *to) {
char *key;
// Set key parameters
to->incipher = myself->incipher;
to->inkeylength = myself->inkeylength;
@ -168,7 +166,7 @@ bool send_ans_key(node_t *to) {
memset(to->late, 0, sizeof(to->late));
// Convert to hexadecimal and send
key = alloca(2 * to->inkeylength + 1);
char key[2 * to->inkeylength + 1];
bin2hex(to->inkey, key, to->inkeylength);
key[to->inkeylength * 2] = '\0';