From: Matthias Wachs Date: Thu, 8 Mar 2012 14:01:52 +0000 (+0000) Subject: - coverity X-Git-Tag: initial-import-from-subversion-38251~14355 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=588b14ec0ec5c59d0dad37dcc0841c1ff0b2942c;p=oweals%2Fgnunet.git - coverity --- diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index b351e9c45..703944a5c 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -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); diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 814b1810d..f1dfcc0aa 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -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); diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c index a69f27665..21e65af29 100644 --- a/src/namestore/test_namestore_api.c +++ b/src/namestore/test_namestore_api.c @@ -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(); diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index bd03987d5..0ed3b63c2 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -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);