- coverity
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 8 Mar 2012 14:01:52 +0000 (14:01 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 8 Mar 2012 14:01:52 +0000 (14:01 +0000)
src/namestore/gnunet-service-namestore.c
src/namestore/namestore_api.c
src/namestore/test_namestore_api.c
src/namestore/test_namestore_api_zone_to_name.c

index b351e9c4514f9f2b8b936949836754e99c3e7d14..703944a5c9255b946cbcadf303973625a62f3e66 100644 (file)
@@ -1259,7 +1259,7 @@ void zone_iteration_proc (void *cls,
     zir_msg->rd_count = htons (rd_count);
     zir_msg->rd_len = htons (rd_ser_len);
     zir_msg->signature = *signature;
-    GNUNET_assert (NULL == zone_key);
+    GNUNET_assert (NULL != zone_key);
     if (zone_key != NULL)
       zir_msg->public_key = *zone_key;
     memcpy (name_tmp, name, name_len);
index 814b1810d02745fb41d69efd1369407148fab464..f1dfcc0aa5918ead18332ba777e05fbd162e98bf 100644 (file)
@@ -262,7 +262,12 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
 
   /* deserialize records */
   struct GNUNET_NAMESTORE_RecordData rd[rd_count];
-  GNUNET_NAMESTORE_records_deserialize(rd_len, rd_tmp, rd_count, rd);
+  if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize(rd_len, rd_tmp, rd_count, rd))
+  {
+    GNUNET_break_op (0);
+    return;
+  }
+
 
   /* reset values if values not contained */
   if (contains_sig == GNUNET_NO)
@@ -475,7 +480,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
     rd_tmp = &name_tmp[name_len];
 
     struct GNUNET_NAMESTORE_RecordData rd[rd_count];
-    GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_tmp, rd_count, rd);
+    if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_tmp, rd_count, rd))
+    {
+      GNUNET_break_op (0);
+      return;
+    }
 
     if (qe->proc != NULL)
       qe->proc (qe->proc_cls, &msg->zone_key, expire, name_tmp, rd_count, rd, &msg->signature);
index a69f276656e1deac90fcdd1e2b286679bd1e311a..21e65af299c36a03fa756a8b6eaac7cf174683dd 100644 (file)
@@ -175,6 +175,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
 
   struct GNUNET_CRYPTO_RsaSignature signature;
+  memset (&signature, '\0', sizeof (signature));
   struct GNUNET_NAMESTORE_RecordData rd;
 
   rd.expiration = GNUNET_TIME_absolute_get();
index bd03987d541a3cef1cb7487c595846dd8535b4a0..0ed3b63c2ea95249876b10243d47336739cf7154 100644 (file)
@@ -145,7 +145,7 @@ void zone_to_name_proc (void *cls,
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result found: `%s'\n", n);
-    if (0 != strcmp(n, s_name))
+    if ((n == NULL) || (0 != strcmp(n, s_name)))
     {
       fail = GNUNET_YES;
       GNUNET_break (0);
@@ -155,7 +155,7 @@ void zone_to_name_proc (void *cls,
       fail = GNUNET_YES;
       GNUNET_break (0);
     }
-    if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))
+    if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))))
     {
       fail = GNUNET_YES;
       GNUNET_break (0);