Fix length check in python 3 PYTHON-571

This commit is contained in:
Bernie Hackett 2013-10-08 14:34:27 -07:00
parent cc942556b5
commit 17fd05f8fa

View File

@ -143,7 +143,7 @@ def _get_string(data, position, as_class, tz_aware, uuid_subtype):
if (len(data) - position - 4) < length:
raise InvalidBSON("invalid string length")
position += 4
if data[position + length - 1] != ZERO:
if data[position + length - 1:position + length] != ZERO:
raise InvalidBSON("invalid end of string")
return _get_c_string(data, position, length - 1)