Commit 9a6c3ce8 authored by GwendoCG's avatar GwendoCG Committed by Juliusz Chroboczek

Fix parsing of sub-TLVs.

parent 2eed758a
...@@ -299,12 +299,12 @@ parse_other_subtlv(const unsigned char *a, int alen) ...@@ -299,12 +299,12 @@ parse_other_subtlv(const unsigned char *a, int alen)
} }
if(i + 1 > alen) { if(i + 1 > alen) {
fprintf(stderr, "Received truncated sub-TLV on IHU.\n"); fprintf(stderr, "Received truncated sub-TLV.\n");
return -1; return -1;
} }
len = a[i + 1]; len = a[i + 1];
if(i + len > alen) { if(i + len > alen) {
fprintf(stderr, "Received truncated sub-TLV on IHU.\n"); fprintf(stderr, "Received truncated sub-TLV.\n");
return -1; return -1;
} }
...@@ -586,7 +586,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -586,7 +586,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
format_address(from), ifp->name); format_address(from), ifp->name);
if(message[2] == 0) { if(message[2] == 0) {
rc = parse_other_subtlv(message + 12, len - 8); rc = parse_other_subtlv(message + 12, len - 10);
if(rc < 0) if(rc < 0)
goto done; goto done;
if(metric < 0xFFFF) { if(metric < 0xFFFF) {
...@@ -731,7 +731,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -731,7 +731,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
if(ae == 0) { if(ae == 0) {
debugf("Received invalid Source-Specific wildcard update.\n"); debugf("Received invalid Source-Specific wildcard update.\n");
rc = parse_other_subtlv(message + 12, len - 8); rc = parse_other_subtlv(message + 12, len - 10);
if(rc < 0) if(rc < 0)
goto done; goto done;
retract_neighbour_routes(neigh); retract_neighbour_routes(neigh);
......
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