stun: check identifier before using it
authorMichael Olbrich <m.olbrich@pengutronix.de>
Mon, 9 Jul 2018 13:08:15 +0000 (15:08 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Sun, 21 Oct 2018 08:19:33 +0000 (08:19 +0000)
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

index 47d998b..2d76ff0 100644 (file)
@@ -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;