aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-03-05 11:36:08 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2018-03-05 10:36:08 -0500
commit388d1bd3e9cd953fcc948edbc152d5d140c87eb8 (patch)
tree2f4706308b3d5846a457bdc4d49e02eed4265576 /src/cryptography/x509
parent96787f954bf89b12dfc3f8744bcb0998b2f0c22f (diff)
downloadcryptography-388d1bd3e9cd953fcc948edbc152d5d140c87eb8.tar.gz
cryptography-388d1bd3e9cd953fcc948edbc152d5d140c87eb8.tar.bz2
cryptography-388d1bd3e9cd953fcc948edbc152d5d140c87eb8.zip
don't allow GeneralNames to be an empty list (#4128)
* don't allow GeneralNames to be an empty list * flake8
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r--src/cryptography/x509/extensions.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index eb4b927f..af12fa9c 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -1160,6 +1160,9 @@ class Extension(object):
class GeneralNames(object):
def __init__(self, general_names):
general_names = list(general_names)
+ if len(general_names) == 0:
+ raise ValueError("Must supply at least one general name")
+
if not all(isinstance(x, GeneralName) for x in general_names):
raise TypeError(
"Every item in the general_names list must be an "