]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5110] Fixed off-by-one error in port checks.
authorTomek Mrugalski <tomasz@isc.org>
Fri, 17 Feb 2017 12:49:16 +0000 (13:49 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 17 Feb 2017 12:49:16 +0000 (13:49 +0100)
src/bin/d2/d2_parser.cc
src/bin/d2/d2_parser.yy
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
src/bin/d2/tests/d2_simple_parser_unittest.cc
src/bin/d2/tests/testdata/d2_cfg_tests.json

index b17cec23297ca9ccf256e78b411f1a78b62ec957..9ba3a3408f4a359d60458d50245d4edfe87697c7 100644 (file)
@@ -894,8 +894,8 @@ namespace isc { namespace d2 {
   case 67:
 #line 274 "d2_parser.yy" // lalr1.cc:859
     {
-    if (yystack_[0].value.as< int64_t > () <= 0 || yystack_[0].value.as< int64_t > () >= 65535 ) {
-        error(yystack_[0].location, "port must be greater than zero but less than 65535");
+    if (yystack_[0].value.as< int64_t > () <= 0 || yystack_[0].value.as< int64_t > () >= 65536 ) {
+        error(yystack_[0].location, "port must be greater than zero but less than 65536");
     }
     ElementPtr i(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
     ctx.stack_.back()->set("port", i);
@@ -1231,7 +1231,7 @@ namespace isc { namespace d2 {
   case 127:
 #line 486 "d2_parser.yy" // lalr1.cc:859
     {
-    if (yystack_[0].value.as< int64_t > () <= 0 || yystack_[0].value.as< int64_t > () >= 65535 ) {
+    if (yystack_[0].value.as< int64_t > () <= 0 || yystack_[0].value.as< int64_t > () >= 65536 ) {
         error(yystack_[0].location, "port must be greater than zero but less than 65536");
     }
     ElementPtr i(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
index 36df4a48ed886e8699761470363f1af049e319bf..5c585d1e8a177d92f208ce81f019110826693527 100644 (file)
@@ -272,8 +272,8 @@ ip_address: IP_ADDRESS {
 };
 
 port: PORT COLON INTEGER {
-    if ($3 <= 0 || $3 >= 65535 ) {
-        error(@3, "port must be greater than zero but less than 65535");
+    if ($3 <= 0 || $3 >= 65536 ) {
+        error(@3, "port must be greater than zero but less than 65536");
     }
     ElementPtr i(new IntElement($3, ctx.loc2pos(@3)));
     ctx.stack_.back()->set("port", i);
@@ -484,7 +484,7 @@ dns_server_ip_address: IP_ADDRESS {
 };
 
 dns_server_port: PORT COLON INTEGER {
-    if ($3 <= 0 || $3 >= 65535 ) {
+    if ($3 <= 0 || $3 >= 65536 ) {
         error(@3, "port must be greater than zero but less than 65536");
     }
     ElementPtr i(new IntElement($3, ctx.loc2pos(@3)));
index 36e035e1be1b49ec511df33831b928e881857e9e..dc82d2618a3383961e954c3f280caeb704bcc15d 100644 (file)
@@ -421,7 +421,7 @@ TEST_F(D2CfgMgrTest, invalidEntry) {
 
     // Cannot use port  0
     config = makeParamsConfigString ("127.0.0.1", 0, 333, "UDP", "JSON");
-    SYNTAX_ERROR(config, "<string>:1.40: port must be greater than zero but less than 65535");
+    SYNTAX_ERROR(config, "<string>:1.40: port must be greater than zero but less than 65536");
 
     // Cannot use dns server timeout of 0
     config = makeParamsConfigString ("127.0.0.1", 777, 0, "UDP", "JSON");
index 07d8357b457db50d4edc6b9ffc3724d7fa38e043..6253f124e6e8af7c634fb55ddbed85ae8def88fa 100644 (file)
@@ -961,7 +961,7 @@ TEST_F(DdnsDomainParserTest, invalidDomain) {
              "  \"dns-servers\" : [ "
              "  {  \"ip-address\": \"127.0.0.3\" , "
              "    \"port\": -1 } ] } ";
-    PARSE_FAIL(config, "<string>:1.111-112: port must be greater than zero but less than 65792");
+    PARSE_FAIL(config, "<string>:1.111-112: port must be greater than zero but less than 65536");
 
     // Create a domain configuration without an defined key name
     config = "{ \"name\": \"example.com\" , "
index 4144e381c31d0fac8bf1139fca8a0f1bb0c083e9..ed0052f3c728c663bfa1066cfaca11516d8fc4e5 100644 (file)
 #-----
 ,{
 "description" : "D2.forward-ddns.dhcp-ddns.dns-servers.port cannot be 0 ",
-"syntax-error" : "<string>:1.97: port must be greater than zero but less than 65792",
+"syntax-error" : "<string>:1.97: port must be greater than zero but less than 65536",
 "data" :
     {
     "forward-ddns" :
 #-----
 ,{
 "description" : "D2.reverse-ddns.dhcp-ddns.dns-servers.port cannot be 0 ",
-"syntax-error" : "<string>:1.119: port must be greater than zero but less than 65792",
+"syntax-error" : "<string>:1.119: port must be greater than zero but less than 65536",
 "data" :
     {
     "forward-ddns" : {},