summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-ssl-utils.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-09-24 13:09:36 +0200
committerAnders Broman <a.broman58@gmail.com>2016-09-27 03:49:39 +0000
commitb5eb01c1a5219f075897b1cc5bc8f1883262af3b (patch)
treee546bbcd95beec9166e1676b1c865b0b4d94034f /epan/dissectors/packet-ssl-utils.c
parent7bca5e168817f6f665e9aaec70ca37722c7afbea (diff)
downloadwireshark-b5eb01c1a5219f075897b1cc5bc8f1883262af3b.tar.gz
ssl: fix crash when setting RSA key file without valid protocol
If ssl_association_add is passed a NULL app_handle argument, it will trigger DISSECTOR_ASSERT which fails due to the bad wmem scope (wmem_packet_scope). Arguably DISSECTOR_ASSERT should not be used there, but its alternative is g_warning/g_assert are not much different... Fix the crash (assertion failure) by checking that the UAT-supplied protocol is really valid. Normally the post_update_cb should not be invoked if any of the fields are invalid, but that requires larger changes in the Qt UAT dialog code. Change-Id: Ie245213b650b1de9640db8dadd08f3ed2bff335f Reviewed-on: https://code.wireshark.org/review/17906 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ssl-utils.c')
-rw-r--r--epan/dissectors/packet-ssl-utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index aab0f1feca..1667590cda 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -4643,13 +4643,13 @@ ssl_parse_key_list(const ssldecrypt_assoc_t *uats, GHashTable *key_hash, const c
key_id = NULL; /* used in key_hash, do not free. */
ssl_debug_printf("ssl_init private key file %s successfully loaded.\n", uats->keyfile);
- {
+ handle = ssl_find_appdata_dissector(uats->protocol);
+ if (handle) {
/* Port to subprotocol mapping */
int port = atoi(uats->port); /* Also maps "start_tls" -> 0 (wildcard) */
ssl_debug_printf("ssl_init port '%d' filename '%s' password(only for p12 file) '%s'\n",
port, uats->keyfile, uats->password);
- handle = ssl_find_appdata_dissector(uats->protocol);
ssl_association_add(dissector_table_name, main_handle, handle, port, tcp);
}