summaryrefslogtreecommitdiff
path: root/paramiko/pkey.py
diff options
context:
space:
mode:
authorJared Hobbs <jared@pyhacker.com>2019-03-20 10:08:12 -0600
committerJared Hobbs <jared@pyhacker.com>2019-03-20 10:08:12 -0600
commit8d57be27ddeda68cbc0f97ee857871aadb5c5170 (patch)
tree42741b3fcd29f5bfda67b5933f3fa2566a8018f5 /paramiko/pkey.py
parent242be1a5c978ed1ddeb4ab3b40e0cf5b1e97b9de (diff)
downloadparamiko-8d57be27ddeda68cbc0f97ee857871aadb5c5170.tar.gz
handle exception that can occur if no regex match
Diffstat (limited to 'paramiko/pkey.py')
-rw-r--r--paramiko/pkey.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index f2447e15..0464795a 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -307,8 +307,8 @@ class PKey(object):
start += 1
m = self.BEGIN_TAG.match(lines[start])
start += 1
- keytype = m.group(1)
- if start >= len(lines):
+ keytype = m.group(1) if m else None
+ if start >= len(lines) or keytype is None:
raise SSHException("not a valid " + tag + " private key file")
# find the END tag