From cd8d66fe911a044c707b7e3d41e22df2b873f75f Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Fri, 13 Dec 2019 14:09:10 -0500 Subject: [PATCH] Fix a bug with attribute index handling in ModifyAttribute This changes fixes a minor bug with proper attribute index range checking in the server implementation of ModifyAttribute. A corner case that previously slipped through index checking and testing has been closed. An existing unit test has been modified to fix this bug. Partially implements #547 --- kmip/services/server/engine.py | 2 +- kmip/tests/unit/services/server/test_engine.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kmip/services/server/engine.py b/kmip/services/server/engine.py index ed784b0..4c5ff50 100644 --- a/kmip/services/server/engine.py +++ b/kmip/services/server/engine.py @@ -1876,7 +1876,7 @@ class KmipEngine(object): managed_object, attribute_name ) - if 0 <= attribute_index <= len(existing_attributes): + if 0 <= attribute_index < len(existing_attributes): self._set_attribute_on_managed_object_by_index( managed_object, attribute_name, diff --git a/kmip/tests/unit/services/server/test_engine.py b/kmip/tests/unit/services/server/test_engine.py index 004d7dc..617fcc1 100644 --- a/kmip/tests/unit/services/server/test_engine.py +++ b/kmip/tests/unit/services/server/test_engine.py @@ -4975,7 +4975,7 @@ class TestKmipEngine(testtools.TestCase): attribute=attribute_factory.create_attribute( enums.AttributeType.NAME, "Modified Name", - index=3 + index=1 ) ), )