-fix coverity
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Wed, 29 Mar 2017 12:21:30 +0000 (14:21 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Wed, 29 Mar 2017 12:21:30 +0000 (14:21 +0200)
src/gns/plugin_rest_gns.c
src/identity-provider/gnunet-service-identity-provider.c
src/identity-provider/plugin_rest_identity_provider.c
src/namestore/plugin_rest_namestore.c

index 5d4734d9a89c0c7243d437c755d0e327090c75fc..b7775e4eaf6b3f8346fdace202aa595047702434 100644 (file)
@@ -529,6 +529,7 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
   {
     handle->pkey_str = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
                                                           &key);
+    GNUNET_assert (NULL != handle->pkey_str);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->pkey_str,
                                                     strlen(handle->pkey_str),
index 17c2883682e0e1627ecba4474eb31dd83add27e0..53fd02c9ffef54f657dbe73211d3a58064d3bcea 100644 (file)
@@ -442,6 +442,7 @@ handle_token_update (void *cls)
       {
         cur_value = GNUNET_CONTAINER_multihashmap_get (ego_entry->attr_map,
                                                        &key_hash);
+        GNUNET_assert (NULL != cur_value);
         GNUNET_CONTAINER_DLL_insert (new_token->attr_head,
                                      new_token->attr_tail,
                                      cur_value);
index e03f502adb27d9dd0878a3203f0f9144673ce7ca..907b28ba9e3d2585eb19adbef4f1924aabe18efe 100644 (file)
@@ -580,6 +580,7 @@ issue_token_cont (struct GNUNET_REST_RequestHandle *con,
   }
   nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map,
                                                  &key);
+  GNUNET_assert (NULL != nonce_str);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Request nonce: %s\n",
              nonce_str);
@@ -794,6 +795,7 @@ list_token_cont (struct GNUNET_REST_RequestHandle *con_handle,
   }
   ego_val = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map,
                                                &key);
+  GNUNET_assert (NULL != ego_val);
   //Remove non-matching egos
   for (ego_entry = handle->ego_head;
        NULL != ego_entry;)
@@ -866,6 +868,7 @@ exchange_cont (void *cls,
   }
   nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map,
                                                   &key);
+  GNUNET_assert (NULL != nonce_str);
   GNUNET_assert (1 == sscanf (nonce_str, "%"SCNu64, &expected_nonce));
 
   if (ticket_nonce != expected_nonce)
index 0d36cf445129de47c6f8acee470d7901244a933c..50957a5b402229a429421c40546fd4dce3754ae7 100644 (file)
@@ -899,10 +899,11 @@ namestore_zkey_cont (struct GNUNET_REST_RequestHandle *con,
   }
   handle->zkey_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
                                                         &key);
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str,
+  if ((NULL == handle->zkey_str) ||
+      (GNUNET_OK !=
+       GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str,
                                                   strlen (handle->zkey_str),
-                                                  &pubkey))
+                                                   &pubkey)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Zkey invalid %s\n", handle->zkey_str);
@@ -1126,8 +1127,8 @@ rest_identity_process_request(struct GNUNET_REST_RequestHandle *rest_handle,
   {
     type = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
                                               &key);
-
-    handle->type = GNUNET_GNSRECORD_typename_to_number (type);
+    if (NULL != type)
+      handle->type = GNUNET_GNSRECORD_typename_to_number (type);
   }
   name = get_name_from_url (handle->url);
   if (NULL != ego)