aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Bastin <nick.bastin@gmail.com>2015-12-17 05:28:49 -0800
committerNick Bastin <nick.bastin@gmail.com>2015-12-17 05:28:49 -0800
commitf9c30b39f28f25c7da462fe16d989c2050dee2a7 (patch)
treedf6a81c67c74cd4916a6279fc8dbad08d1bc63e0 /src
parent6721fb8dd70a2d392aa70b67b35e3c6efa34230b (diff)
downloadcryptography-f9c30b39f28f25c7da462fe16d989c2050dee2a7.tar.gz
cryptography-f9c30b39f28f25c7da462fe16d989c2050dee2a7.tar.bz2
cryptography-f9c30b39f28f25c7da462fe16d989c2050dee2a7.zip
Avoid IndexError on too-short OIDs, add test for regression
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509/oid.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cryptography/x509/oid.py b/src/cryptography/x509/oid.py
index ba77a8b8..f5dc2f81 100644
--- a/src/cryptography/x509/oid.py
+++ b/src/cryptography/x509/oid.py
@@ -26,6 +26,11 @@ class ObjectIdentifier(object):
"Malformed OID: %s (non-integer nodes)" % (
self._dotted_string))
+ if len(nodes) < 2:
+ raise ValueError(
+ "Malformed OID: %s (insufficient number of nodes)" % (
+ self._dotted_string)
+
if intnodes[0] > 2:
raise ValueError(
"Malformed OID: %s (first node outside valid range)" % (