BUG: Prevent npdu_len from wrapping around at npdu_len=1 (#452)
This commit is contained in:
committed by
GitHub
parent
758cac3bed
commit
da4db7c65e
@@ -662,7 +662,8 @@ static void network_control_handler(uint16_t snet,
|
|||||||
case NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK:
|
case NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK:
|
||||||
/* add its DNETs to our routing table */
|
/* add its DNETs to our routing table */
|
||||||
fprintf(stderr, "for Networks: ");
|
fprintf(stderr, "for Networks: ");
|
||||||
while (npdu_len) {
|
len = 2;
|
||||||
|
while (npdu_len >= len) {
|
||||||
len = decode_unsigned16(&npdu[npdu_offset], &dnet);
|
len = decode_unsigned16(&npdu[npdu_offset], &dnet);
|
||||||
fprintf(stderr, "%hu", dnet);
|
fprintf(stderr, "%hu", dnet);
|
||||||
dnet_add(snet, dnet, src);
|
dnet_add(snet, dnet, src);
|
||||||
|
|||||||
Reference in New Issue
Block a user