Skip to content

Commit

Permalink
Don't copy nonce, suppress VLA.
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA authored and jech committed May 30, 2021
1 parent c243769 commit ef3a113
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions message.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,9 @@ preparse_packet(const unsigned char *packet, int bodylen,
debugf("Challenge failed.\n");
}
} else if(type == MESSAGE_CHALLENGE_REQUEST) {
unsigned char nonce[len];
debugf("Received challenge request from %s.\n",
format_address(neigh->address));
memcpy(nonce, message + 2, len);
send_challenge_reply(neigh, nonce, len);
send_challenge_reply(neigh, message + 2, len);
}
i += len + 2;
}
Expand Down Expand Up @@ -1230,7 +1228,7 @@ send_challenge_req(struct neighbour *neigh)
}

void
send_challenge_reply(struct neighbour *neigh, unsigned char *crypto_nonce,
send_challenge_reply(struct neighbour *neigh, const unsigned char *crypto_nonce,
int len)
{
debugf("Sending challenge reply to %s on %s.\n",
Expand Down
3 changes: 2 additions & 1 deletion message.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ int send_crypto_seqno(struct buffered *buf, struct interface *ifp);
void send_ack(struct neighbour *neigh, unsigned short nonce,
unsigned short interval);
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_unicast_hello(struct neighbour *neigh, unsigned interval, int force);
void send_hello(struct interface *ifp);
Expand Down

0 comments on commit ef3a113

Please sign in to comment.