agent: Avoid a potential NULL pointer dereference
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 17 Dec 2013 09:35:31 +0000 (09:35 +0000)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Wed, 18 Dec 2013 22:50:57 +0000 (17:50 -0500)
password could be NULL (priv_get_password() can return NULL), but
g_base64_decode() aborts if it receives NULL for the encoded text.

agent/conncheck.c

index d12f603..20aac34 100644 (file)
@@ -1660,8 +1660,9 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
   size_t buffer_len;
   unsigned int timeout;
 
-  if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
-      agent->compatibility == NICE_COMPATIBILITY_OC2007) {
+  if (password != NULL &&
+      (agent->compatibility == NICE_COMPATIBILITY_MSN ||
+       agent->compatibility == NICE_COMPATIBILITY_OC2007)) {
     password = g_base64_decode ((gchar *) password, &password_len);
   }