Commit ef3a113a authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Don't copy nonce, suppress VLA.

parent c2437694
...@@ -502,11 +502,9 @@ preparse_packet(const unsigned char *packet, int bodylen, ...@@ -502,11 +502,9 @@ preparse_packet(const unsigned char *packet, int bodylen,
debugf("Challenge failed.\n"); debugf("Challenge failed.\n");
} }
} else if(type == MESSAGE_CHALLENGE_REQUEST) { } else if(type == MESSAGE_CHALLENGE_REQUEST) {
unsigned char nonce[len];
debugf("Received challenge request from %s.\n", debugf("Received challenge request from %s.\n",
format_address(neigh->address)); format_address(neigh->address));
memcpy(nonce, message + 2, len); send_challenge_reply(neigh, message + 2, len);
send_challenge_reply(neigh, nonce, len);
} }
i += len + 2; i += len + 2;
} }
...@@ -1230,7 +1228,7 @@ send_challenge_req(struct neighbour *neigh) ...@@ -1230,7 +1228,7 @@ send_challenge_req(struct neighbour *neigh)
} }
void void
send_challenge_reply(struct neighbour *neigh, unsigned char *crypto_nonce, send_challenge_reply(struct neighbour *neigh, const unsigned char *crypto_nonce,
int len) int len)
{ {
debugf("Sending challenge reply to %s on %s.\n", debugf("Sending challenge reply to %s on %s.\n",
......
...@@ -64,7 +64,8 @@ int send_crypto_seqno(struct buffered *buf, struct interface *ifp); ...@@ -64,7 +64,8 @@ int send_crypto_seqno(struct buffered *buf, struct interface *ifp);
void send_ack(struct neighbour *neigh, unsigned short nonce, void send_ack(struct neighbour *neigh, unsigned short nonce,
unsigned short interval); unsigned short interval);
int send_challenge_req(struct neighbour *neigh); int send_challenge_req(struct neighbour *neigh);
void send_challenge_reply(struct neighbour *neigh, unsigned char *crypto_nonce, int len); void send_challenge_reply(struct neighbour *neigh,
const unsigned char *crypto_nonce, int len);
void send_multicast_hello(struct interface *ifp, unsigned interval, int force); void send_multicast_hello(struct interface *ifp, unsigned interval, int force);
void send_unicast_hello(struct neighbour *neigh, unsigned interval, int force); void send_unicast_hello(struct neighbour *neigh, unsigned interval, int force);
void send_hello(struct interface *ifp); void send_hello(struct interface *ifp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment