Skip to content

Commit 19e7bd3

Browse files
authored
Merge pull request FRRouting#20062 from mjstapp/fix_bgp_label_nlri
bgpd: bounds-check when parsing incoming label in nlri
2 parents c07c237 + 1b0f890 commit 19e7bd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bgpd/bgp_label.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen,
424424
if (plen < BGP_LABEL_BYTES)
425425
return 0;
426426

427-
for (; data < lim; data += BGP_LABEL_BYTES) {
427+
for (; (data + BGP_LABEL_BYTES) <= lim; data += BGP_LABEL_BYTES) {
428428
memcpy(label, data, BGP_LABEL_BYTES);
429429
llen += BGP_LABEL_BYTES;
430430

0 commit comments

Comments
 (0)