summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-07-09 15:08:15 +0200
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2018-10-21 08:19:33 +0000
commitb257672b46b00fb5a6a5984ead069e60e5b3d00c (patch)
tree841f81ff79df6cdb5041a6f45a5603aabf6160da
parent2ef4bd7bc4bb148706f30c25be9f49e59a460653 (diff)
downloadlibnice-b257672b46b00fb5a6a5984ead069e60e5b3d00c.tar.gz
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.
-rw-r--r--stun/usages/ice.c3
1 files changed, 2 insertions, 1 deletions
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;