aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-05 21:34:01 -0500
committerJack Lloyd <[email protected]>2016-12-05 21:34:01 -0500
commit8f580945b8f6b4ba6d8d6c55ca433f3c92ea6647 (patch)
treef06d6bebce22735bb17e7778b74e49b89c3ed4d8 /src/lib/tls
parenta1b4f0299ade80d430bc5f1623a3294a897caa0b (diff)
Fix bad deref when ciphersuite value is larger than largest known id
Reported by @neverhub in GH #758 found by libFuzzer
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/tls_ciphersuite.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/tls/tls_ciphersuite.cpp b/src/lib/tls/tls_ciphersuite.cpp
index a15f936be..08ef8e812 100644
--- a/src/lib/tls/tls_ciphersuite.cpp
+++ b/src/lib/tls/tls_ciphersuite.cpp
@@ -45,7 +45,7 @@ Ciphersuite Ciphersuite::by_id(u16bit suite)
const std::vector<Ciphersuite>& all_suites = all_known_ciphersuites();
auto s = std::lower_bound(all_suites.begin(), all_suites.end(), suite);
- if(s->ciphersuite_code() == suite)
+ if(s != all_suites.end() && s->ciphersuite_code() == suite)
{
return *s;
}