Merge pull request #5620 from qlyoung/fix-zebra-vrf-label-afi-check

Fix zebra vrf label afi check
This commit is contained in:
Mark Stapp 2020-01-23 10:59:19 -05:00 committed by GitHub
commit be3a8fa8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -360,6 +360,8 @@ typedef enum {
AFI_MAX = 4
} afi_t;
#define IS_VALID_AFI(a) ((a) > AFI_UNSPEC && (a) < AFI_MAX)
/* Subsequent Address Family Identifier. */
typedef enum {
SAFI_UNSPEC = 0,

View File

@ -2277,6 +2277,12 @@ static void zread_vrf_label(ZAPI_HANDLER_ARGS)
s = msg;
STREAM_GETL(s, nlabel);
STREAM_GETC(s, afi);
if (!(IS_VALID_AFI(afi))) {
zlog_warn("Invalid AFI for VRF label: %u", afi);
return;
}
if (nlabel == zvrf->label[afi]) {
/*
* Nothing to do here move along