Skip to content

Commit cd8d66f

Browse files
committed
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
1 parent e5281cb commit cd8d66f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kmip/services/server/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ def _process_modify_attribute(self, payload):
18761876
managed_object,
18771877
attribute_name
18781878
)
1879-
if 0 <= attribute_index <= len(existing_attributes):
1879+
if 0 <= attribute_index < len(existing_attributes):
18801880
self._set_attribute_on_managed_object_by_index(
18811881
managed_object,
18821882
attribute_name,

kmip/tests/unit/services/server/test_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4975,7 +4975,7 @@ def test_modify_attribute_with_multivalued_no_index_match(self):
49754975
attribute=attribute_factory.create_attribute(
49764976
enums.AttributeType.NAME,
49774977
"Modified Name",
4978-
index=3
4978+
index=1
49794979
)
49804980
),
49814981
)

0 commit comments

Comments
 (0)