int i;
if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord))
return NULL; /* malformed */
- memcpy (&sets,
- data,
- sizeof (sets));
+ GNUNET_memcpy (&sets,
+ data,
+ sizeof (sets));
cdata = data;
struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)];
if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size),
GNUNET_free (tmp_str);
tmp_str = GNUNET_strdup (s);
token = strtok (tmp_str, ",");
+ if (NULL == token)
+ {
+ GNUNET_free (tmp_str);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Malformed string %s\n", s);
+ return GNUNET_SYSERR;
+ }
struct GNUNET_CREDENTIAL_DelegationSet set[entries];
for (i=0;i<entries;i++)
{
}
tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries,
set);
-
+
if (-1 == tmp_data_size)
+ {
+ GNUNET_free (tmp_str);
return GNUNET_SYSERR;
+ }
*data_size += tmp_data_size;
*data = sets = GNUNET_malloc (*data_size);
GNUNET_CREDENTIAL_delegation_set_serialize (entries,
return GNUNET_OK;
}
case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
- {
+ {
struct GNUNET_CREDENTIAL_Credential *cred;
cred = GNUNET_CREDENTIAL_credential_from_string (s);