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

@ -109,15 +109,13 @@ bool id_h(connection_t *c) {
}
bool send_metakey(connection_t *c) {
char *buffer;
int len;
bool x;
len = RSA_size(c->rsa_key);
int len = RSA_size(c->rsa_key);
/* Allocate buffers for the meta key */
buffer = alloca(2 * len + 1);
char buffer[2 * len + 1];
c->outkey = xrealloc(c->outkey, len);
@ -287,16 +285,13 @@ bool metakey_h(connection_t *c) {
}
bool send_challenge(connection_t *c) {
char *buffer;
int len;
/* CHECKME: what is most reasonable value for len? */
len = RSA_size(c->rsa_key);
int len = RSA_size(c->rsa_key);
/* Allocate buffers for the challenge */
buffer = alloca(2 * len + 1);
char buffer[2 * len + 1];
c->hischallenge = xrealloc(c->hischallenge, len);