char *ad_get_entry(const struct adouble *ad, int eid)
{
	size_t bufsize = talloc_get_size(ad->ad_data);
	off_t off = ad_getentryoff(ad, eid);
	size_t len = ad_getentrylen(ad, eid);
	bool valid;

	valid = ad_entry_check_size(eid, bufsize, off, len);
	if (!valid) {
		return NULL;
	}

	if (off == 0 || len == 0) {
		return NULL;
	}

	return ad->ad_data + off;
}
char *ad_get_entry(const struct adouble *ad, int eid)
{
	size_t bufsize = talloc_get_size(ad->ad_data);
	off_t off = ad_getentryoff(ad, eid);
	size_t len = ad_getentrylen(ad, eid);
	bool valid;

	valid = ad_entry_check_size(eid, bufsize, off, len);
	if (!valid) {
		return NULL;
	}

	if (off == 0 || len == 0) {
		return NULL;
	}

	return ad->ad_data + off;
}