From b257672b46b00fb5a6a5984ead069e60e5b3d00c Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 9 Jul 2018 15:08:15 +0200 Subject: stun: check identifier before using it By default, 'candidate_identifier == NULL' only happens for 'compatibility == NICE_COMPATIBILITY_GOOGLE'. However, keepalive=true will also trigger the same code path so candidate_identifier must be checked to avoid a segfault. --- stun/usages/ice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stun/usages/ice.c b/stun/usages/ice.c index 47d998b..2d76ff0 100644 --- a/stun/usages/ice.c +++ b/stun/usages/ice.c @@ -100,7 +100,8 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg, return 0; } - if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_MSICE2) { + if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_MSICE2 && + candidate_identifier) { size_t identifier_len = strlen(candidate_identifier); size_t attribute_len = identifier_len; int modulo4 = identifier_len % 4; -- cgit v1.2.1