rec.record_type = htonl (rd[i].record_type);
rec.flags = htonl (rd[i].flags);
if (off + sizeof (rec) > dest_size)
+ {
+ GNUNET_break (0);
return -1;
+ }
GNUNET_memcpy (&dest[off],
&rec,
sizeof (rec));
off += sizeof (rec);
if (off + rd[i].data_size > dest_size)
+ {
+ GNUNET_break (0);
return -1;
+ }
GNUNET_memcpy (&dest[off],
rd[i].data,
rd[i].data_size);
off += rd[i].data_size;
+#if GNUNET_EXTRA_LOGGING
+ {
+ char *str;
+
+ str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
+ rd[i].data,
+ rd[i].data_size);
+ if (NULL == str)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (str);
+ }
+#endif
}
return off;
}
for (unsigned int i=0;i<rd_count;i++)
{
if (off + sizeof (rec) > len)
+ {
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
+ }
GNUNET_memcpy (&rec,
&src[off],
sizeof (rec));
dest[i].flags = ntohl (rec.flags);
off += sizeof (rec);
if (off + dest[i].data_size > len)
+ {
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
+ }
dest[i].data = &src[off];
off += dest[i].data_size;
+#if GNUNET_EXTRA_LOGGING
+ {
+ char *str;
+
+ str = GNUNET_GNSRECORD_value_to_string (dest[i].record_type,
+ dest[i].data,
+ dest[i].data_size);
+ if (NULL == str)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (str);
+ }
+#endif
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Deserialized record %u with flags %d and expiration time %llu\n",
i,