Fix an off by one error on negative indexs to __getitem__

http://code.google.com/p/ipaddr-py/issues/detail?id=15
This commit is contained in:
Gregory P. Smith 2009-05-08 23:16:47 +00:00
parent f7f858d141
commit 5edb1a1b0a
2 changed files with 12 additions and 0 deletions

View file

@ -209,6 +209,7 @@ class BaseIP(object):
raise IndexError
return self._string_from_ip_int(self.network + n)
else:
n += 1
if self.broadcast + n < self.network:
raise IndexError
return self._string_from_ip_int(self.broadcast + n)