Tidy up CNAME representaion.

Use an explicit discriminator for the target union.
This commit is contained in:
Simon Kelley
2019-10-30 12:58:28 +00:00
parent 376cb97685
commit 1fd56c0e33
3 changed files with 15 additions and 21 deletions

View File

@@ -784,12 +784,11 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
{
if (!cname_count--)
return 0; /* looped CNAMES */
newc = cache_insert(name, NULL, C_IN, now, attl, F_CNAME | F_FORWARD | secflag);
if (newc)
if ((newc = cache_insert(name, NULL, C_IN, now, attl, F_CNAME | F_FORWARD | secflag)))
{
newc->addr.cname.target.cache = NULL;
/* anything other than zero, to avoid being mistaken for a local CNAME */
newc->addr.cname.uid = 1;
newc->addr.cname.is_name_ptr = 0;
if (cpp)
{
next_uid(newc);