From f4c6ca8c9c7ca7c0d481e6059396beed6adc768d Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 17 Sep 2009 13:35:37 +0200 Subject: Fixes preference bounds. --- doc/bird.sgml | 2 +- filter/filter.c | 2 ++ nest/config.Y | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index 29fcd5a9..258b8420 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -724,7 +724,7 @@ defined by using the defined( attribute ) operator. Address scope of the network ( - Preference of the route. (See the chapter about routing tables.) + Preference of the route. Valid values are 0-65535. (See the chapter about routing tables.) The router which the route has originated from. Read-only. diff --git a/filter/filter.c b/filter/filter.c index 3df0f0c6..9617482a 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -702,6 +702,8 @@ interpret(struct f_inst *what) ONEARG; if (v1.type != T_INT) runtime( "Can't set preference to non-integer" ); + if ((v1.val.i < 0) || (v1.val.i > 0xFFFF)) + runtime( "Setting preference value out of bounds" ); *f_rte = rte_cow(*f_rte); (*f_rte)->pref = v1.val.i; break; diff --git a/nest/config.Y b/nest/config.Y index ad45a0d5..a2c44ab7 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -132,7 +132,7 @@ proto_name: proto_item: /* EMPTY */ | PREFERENCE expr { - if ($2 < 0 || $2 > 255) cf_error("Invalid preference"); + if ($2 < 0 || $2 > 0xFFFF) cf_error("Invalid preference"); this_proto->preference = $2; } | DISABLED bool { this_proto->disabled = $2; } -- cgit v1.2.3