const ctf_preamble_t *
ctf_arc_bufpreamble (const ctf_sect_t *ctfsect)
{
- if (ctfsect->cts_size > sizeof (uint64_t) &&
- (le64toh ((*(uint64_t *) ctfsect->cts_data)) == CTFA_MAGIC))
+ if (ctfsect->cts_data != NULL
+ && ctfsect->cts_size > sizeof (uint64_t)
+ && (le64toh ((*(uint64_t *) ctfsect->cts_data)) == CTFA_MAGIC))
{
struct ctf_archive *arc = (struct ctf_archive *) ctfsect->cts_data;
return (const ctf_preamble_t *) ((char *) arc + le64toh (arc->ctfa_ctfs)
int is_archive;
ctf_dict_t *fp = NULL;
- if (ctfsect->cts_size > sizeof (uint64_t) &&
- (le64toh ((*(uint64_t *) ctfsect->cts_data)) == CTFA_MAGIC))
+ if (ctfsect->cts_data != NULL
+ && ctfsect->cts_size > sizeof (uint64_t)
+ && (le64toh ((*(uint64_t *) ctfsect->cts_data)) == CTFA_MAGIC))
{
/* The archive is mmappable, so this operation is trivial.
if (strsect != NULL && strsect->cts_data == NULL)
return (ctf_set_open_errno (errp, ECTF_STRBAD));
- if (ctfsect->cts_size < sizeof (ctf_preamble_t))
+ if (ctfsect->cts_data == NULL
+ || ctfsect->cts_size < sizeof (ctf_preamble_t))
return (ctf_set_open_errno (errp, ECTF_NOCTFBUF));
pp = (const ctf_preamble_t *) ctfsect->cts_data;