is_name_synthetic:
   26|    587|{
   27|    587|  char *p;
   28|    587|  struct cond_domain *c = NULL;
   29|    587|  int prot = (flags & F_IPV6) ? AF_INET6 : AF_INET;
  ------------------
  |  |  523|    587|#define F_IPV6      (1u<<8)
  ------------------
  |  Branch (29:14): [True: 0, False: 587]
  ------------------
   30|    587|  union all_addr addr;
   31|       |  
   32|    587|  for (c = daemon->synth_domains; c; c = c->next)
  ------------------
  |  |  169|    587|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (32:35): [True: 0, False: 587]
  ------------------
   33|      0|    {
   34|      0|      int found = 0;
   35|      0|      char *tail, *pref;
   36|       |      
   37|      0|      for (tail = name, pref = c->prefix; *tail != 0 && pref && *pref != 0; tail++, pref++)
  ------------------
  |  Branch (37:43): [True: 0, False: 0]
  |  Branch (37:57): [True: 0, False: 0]
  |  Branch (37:65): [True: 0, False: 0]
  ------------------
   38|      0|	{
   39|      0|	  unsigned int c1 = (unsigned char) *pref;
   40|      0|	  unsigned int c2 = (unsigned char) *tail;
   41|       |	  
   42|      0|	  if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (42:8): [True: 0, False: 0]
  |  Branch (42:21): [True: 0, False: 0]
  ------------------
   43|      0|	    c1 += 'a' - 'A';
   44|      0|	  if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (44:8): [True: 0, False: 0]
  |  Branch (44:21): [True: 0, False: 0]
  ------------------
   45|      0|	    c2 += 'a' - 'A';
   46|       |	  
   47|      0|	  if (c1 != c2)
  ------------------
  |  Branch (47:8): [True: 0, False: 0]
  ------------------
   48|      0|	    break;
   49|      0|	}
   50|       |      
   51|      0|      if (pref && *pref != 0)
  ------------------
  |  Branch (51:11): [True: 0, False: 0]
  |  Branch (51:19): [True: 0, False: 0]
  ------------------
   52|      0|	continue; /* prefix match fail */
   53|       |
   54|      0|      if (c->indexed)
  ------------------
  |  Branch (54:11): [True: 0, False: 0]
  ------------------
   55|      0|	{
   56|      0|	  for (p = tail; *p; p++)
  ------------------
  |  Branch (56:19): [True: 0, False: 0]
  ------------------
   57|      0|	    {
   58|      0|	      char c = *p;
   59|       |	      
   60|      0|	      if (c < '0' || c > '9')
  ------------------
  |  Branch (60:12): [True: 0, False: 0]
  |  Branch (60:23): [True: 0, False: 0]
  ------------------
   61|      0|		break;
   62|      0|	    }
   63|       |	  
   64|      0|	  if (*p != '.')
  ------------------
  |  Branch (64:8): [True: 0, False: 0]
  ------------------
   65|      0|	    continue;
   66|       |	  
   67|      0|	  *p = 0;
   68|       |	  
   69|      0|	  if (hostname_isequal(c->domain, p+1))
  ------------------
  |  Branch (69:8): [True: 0, False: 0]
  ------------------
   70|      0|	    {
   71|      0|	      if (prot == AF_INET)
  ------------------
  |  Branch (71:12): [True: 0, False: 0]
  ------------------
   72|      0|		{
   73|      0|		  unsigned int index = atoi(tail);
   74|       |
   75|      0|		   if (!c->is6 &&
  ------------------
  |  Branch (75:10): [True: 0, False: 0]
  ------------------
   76|      0|		      index <= ntohl(c->end.s_addr) - ntohl(c->start.s_addr))
  ------------------
  |  Branch (76:9): [True: 0, False: 0]
  ------------------
   77|      0|		    {
   78|      0|		      addr.addr4.s_addr = htonl(ntohl(c->start.s_addr) + index);
   79|      0|		      found = 1;
   80|      0|		    }
   81|      0|		} 
   82|      0|	      else
   83|      0|		{
   84|      0|		  u64 index = atoll(tail);
   85|       |		  
   86|      0|		  if (c->is6 &&
  ------------------
  |  Branch (86:9): [True: 0, False: 0]
  ------------------
   87|      0|		      index <= addr6part(&c->end6) - addr6part(&c->start6))
  ------------------
  |  Branch (87:9): [True: 0, False: 0]
  ------------------
   88|      0|		    {
   89|      0|		      u64 start = addr6part(&c->start6);
   90|      0|		      addr.addr6 = c->start6;
   91|      0|		      setaddr6part(&addr.addr6, start + index);
   92|      0|		      found = 1;
   93|      0|		    }
   94|      0|		}
   95|      0|	    }
   96|      0|	}
   97|      0|      else
   98|      0|	{
   99|       |	  /* NB, must not alter name if we return zero */
  100|      0|	  for (p = tail; *p; p++)
  ------------------
  |  Branch (100:19): [True: 0, False: 0]
  ------------------
  101|      0|	    {
  102|      0|	      char c = *p;
  103|       |	      
  104|      0|	      if ((c >='0' && c <= '9') || c == '-')
  ------------------
  |  Branch (104:13): [True: 0, False: 0]
  |  Branch (104:24): [True: 0, False: 0]
  |  Branch (104:37): [True: 0, False: 0]
  ------------------
  105|      0|		continue;
  106|       |	      
  107|      0|	      if (prot == AF_INET6 && ((c >='A' && c <= 'F') || (c >='a' && c <= 'f'))) 
  ------------------
  |  Branch (107:12): [True: 0, False: 0]
  |  Branch (107:34): [True: 0, False: 0]
  |  Branch (107:45): [True: 0, False: 0]
  |  Branch (107:59): [True: 0, False: 0]
  |  Branch (107:70): [True: 0, False: 0]
  ------------------
  108|      0|		continue;
  109|       |	      
  110|      0|	      break;
  111|      0|	    }
  112|       |	  
  113|      0|	  if (*p != '.')
  ------------------
  |  Branch (113:8): [True: 0, False: 0]
  ------------------
  114|      0|	    continue;
  115|       |	  
  116|      0|	  *p = 0;	
  117|       |	  
  118|       |	  /* swap . or : for - */
  119|      0|	  for (p = tail; *p; p++)
  ------------------
  |  Branch (119:19): [True: 0, False: 0]
  ------------------
  120|      0|	    if (*p == '-')
  ------------------
  |  Branch (120:10): [True: 0, False: 0]
  ------------------
  121|      0|	      {
  122|      0|		if (prot == AF_INET)
  ------------------
  |  Branch (122:7): [True: 0, False: 0]
  ------------------
  123|      0|		  *p = '.';
  124|      0|		else
  125|      0|		  *p = ':';
  126|      0|	      }
  127|       |	  
  128|      0|	  if (hostname_isequal(c->domain, p+1) && inet_pton(prot, tail, &addr))
  ------------------
  |  Branch (128:8): [True: 0, False: 0]
  |  Branch (128:44): [True: 0, False: 0]
  ------------------
  129|      0|	    found = (prot == AF_INET) ? match_domain(addr.addr4, c) : match_domain6(&addr.addr6, c);
  ------------------
  |  Branch (129:14): [True: 0, False: 0]
  ------------------
  130|      0|	}
  131|       |      
  132|       |      /* restore name */
  133|      0|      for (p = tail; *p; p++)
  ------------------
  |  Branch (133:22): [True: 0, False: 0]
  ------------------
  134|      0|	if (*p == '.' || *p == ':')
  ------------------
  |  Branch (134:6): [True: 0, False: 0]
  |  Branch (134:19): [True: 0, False: 0]
  ------------------
  135|      0|	  *p = '-';
  136|       |      
  137|      0|      *p = '.';
  138|       |      
  139|       |      
  140|      0|      if (found)
  ------------------
  |  Branch (140:11): [True: 0, False: 0]
  ------------------
  141|      0|	{
  142|      0|	  if (addrp)
  ------------------
  |  Branch (142:8): [True: 0, False: 0]
  ------------------
  143|      0|	    *addrp = addr;
  144|       |	  
  145|      0|	  return 1;
  146|      0|	}
  147|      0|    }
  148|       |  
  149|    587|  return 0;
  150|    587|}

legal_hostname:
  215|    587|{
  216|    587|  char c;
  217|    587|  int first;
  218|       |
  219|    587|  if (!check_name(name))
  ------------------
  |  Branch (219:7): [True: 259, False: 328]
  ------------------
  220|    259|    return 0;
  221|       |
  222|  1.73k|  for (first = 1; (c = *name); name++, first = 0)
  ------------------
  |  Branch (222:19): [True: 1.58k, False: 151]
  ------------------
  223|       |    /* check for legal char a-z A-Z 0-9 - _ . */
  224|  1.58k|    {
  225|  1.58k|      if ((c >= 'A' && c <= 'Z') ||
  ------------------
  |  Branch (225:12): [True: 924, False: 664]
  |  Branch (225:24): [True: 345, False: 579]
  ------------------
  226|  1.24k|	  (c >= 'a' && c <= 'z') ||
  ------------------
  |  Branch (226:5): [True: 415, False: 828]
  |  Branch (226:17): [True: 409, False: 6]
  ------------------
  227|    834|	  (c >= '0' && c <= '9'))
  ------------------
  |  Branch (227:5): [True: 619, False: 215]
  |  Branch (227:17): [True: 421, False: 198]
  ------------------
  228|  1.17k|	continue;
  229|       |
  230|    413|      if (!first && (c == '-' || c == '_'))
  ------------------
  |  Branch (230:11): [True: 288, False: 125]
  |  Branch (230:22): [True: 86, False: 202]
  |  Branch (230:34): [True: 150, False: 52]
  ------------------
  231|    236|	continue;
  232|       |      
  233|       |      /* end of hostname part */
  234|    177|      if (c == '.')
  ------------------
  |  Branch (234:11): [True: 20, False: 157]
  ------------------
  235|     20|	return 1;
  236|       |      
  237|    157|      return 0;
  238|    177|    }
  239|       |  
  240|    151|  return 1;
  241|    328|}
canonicalise:
  244|    587|{
  245|    587|  char *ret = NULL;
  246|    587|  int rc;
  247|       |  
  248|    587|  if (nomem)
  ------------------
  |  Branch (248:7): [True: 0, False: 587]
  ------------------
  249|      0|    *nomem = 0;
  250|       |  
  251|    587|  if (!(rc = check_name(in)))
  ------------------
  |  Branch (251:7): [True: 310, False: 277]
  ------------------
  252|    310|    return NULL;
  253|       |  
  254|       |#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
  255|       |  if (rc == 2)
  256|       |    {
  257|       |#  ifdef HAVE_LIBIDN2
  258|       |      rc = idn2_to_ascii_lz(in, &ret, IDN2_NONTRANSITIONAL);
  259|       |#  else
  260|       |      rc = idna_to_ascii_lz(in, &ret, 0);
  261|       |#  endif
  262|       |      if (rc != IDNA_SUCCESS)
  263|       |	{
  264|       |	  if (ret)
  265|       |	    free(ret);
  266|       |	  
  267|       |	  if (nomem && (rc == IDNA_MALLOC_ERROR || rc == IDNA_DLOPEN_ERROR))
  268|       |	    {
  269|       |	      my_syslog(LOG_ERR, _("failed to allocate memory"));
  270|       |	      *nomem = 1;
  271|       |	    }
  272|       |	  
  273|       |	  return NULL;
  274|       |	}
  275|       |
  276|       |      /* IDN library doesnt call our malloc wrapper, so log this by steam */
  277|       |      if (ret)
  278|       |	malloc_log(ret, strlen(ret)+1);
  279|       |      
  280|       |      return ret;
  281|       |    }
  282|       |#else
  283|    277|  (void)rc;
  284|    277|#endif
  285|       |  
  286|    277|  if ((ret = whine_malloc(strlen(in)+1)))
  ------------------
  |  | 1509|    277|#define whine_malloc(x) whine_malloc_real(__func__, __LINE__, (x))
  ------------------
  |  Branch (286:7): [True: 277, False: 0]
  ------------------
  287|    277|    strcpy(ret, in);
  288|      0|  else if (nomem)
  ------------------
  |  Branch (288:12): [True: 0, False: 0]
  ------------------
  289|      0|    *nomem = 1;
  290|       |
  291|    277|  return ret;
  292|    587|}
hostname_order:
  405|    161|{
  406|    161|  unsigned int c1, c2;
  407|       |  
  408|  2.59k|  do {
  409|  2.59k|    c1 = (unsigned char) *a++;
  410|  2.59k|    c2 = (unsigned char) *b++;
  411|       |    
  412|  2.59k|    if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (412:9): [True: 1.34k, False: 1.24k]
  |  Branch (412:22): [True: 274, False: 1.07k]
  ------------------
  413|    274|      c1 += 'a' - 'A';
  414|  2.59k|    if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (414:9): [True: 1.35k, False: 1.24k]
  |  Branch (414:22): [True: 379, False: 977]
  ------------------
  415|    379|      c2 += 'a' - 'A';
  416|       |    
  417|  2.59k|    if (c1 < c2)
  ------------------
  |  Branch (417:9): [True: 53, False: 2.54k]
  ------------------
  418|     53|      return -1;
  419|  2.54k|    else if (c1 > c2)
  ------------------
  |  Branch (419:14): [True: 49, False: 2.49k]
  ------------------
  420|     49|      return 1;
  421|       |    
  422|  2.59k|  } while (c1);
  ------------------
  |  Branch (422:12): [True: 2.43k, False: 59]
  ------------------
  423|       |  
  424|     59|  return 0;
  425|    161|}
hostname_isequal:
  428|    587|{
  429|    587|  return strlen(a) == strlen(b) && hostname_order(a, b) == 0;
  ------------------
  |  Branch (429:10): [True: 161, False: 426]
  |  Branch (429:36): [True: 59, False: 102]
  ------------------
  430|    587|}
hostname_issubdomain:
  434|    587|{
  435|    587|  char *ap, *bp;
  436|    587|  unsigned int c1, c2;
  437|       |  
  438|       |  /* move to the end */
  439|  12.6k|  for (ap = a; *ap; ap++); 
  ------------------
  |  Branch (439:16): [True: 12.0k, False: 587]
  ------------------
  440|  17.6k|  for (bp = b; *bp; bp++);
  ------------------
  |  Branch (440:16): [True: 17.0k, False: 587]
  ------------------
  441|       |
  442|       |  /* anything is a subdomain of the root domain. */
  443|    587|  if (ap == a)
  ------------------
  |  Branch (443:7): [True: 35, False: 552]
  ------------------
  444|     35|    return (bp == b) ? 2 : 1;
  ------------------
  |  Branch (444:12): [True: 13, False: 22]
  ------------------
  445|       |  
  446|       |  /* b shorter than a */
  447|    552|  if ((bp - b) < (ap - a))
  ------------------
  |  Branch (447:7): [True: 215, False: 337]
  ------------------
  448|    215|    return 0;
  449|       |  
  450|    337|  do
  451|  2.84k|    {
  452|  2.84k|      c1 = (unsigned char) *(--ap);
  453|  2.84k|      c2 = (unsigned char) *(--bp);
  454|       |  
  455|  2.84k|       if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (455:12): [True: 1.26k, False: 1.58k]
  |  Branch (455:25): [True: 410, False: 850]
  ------------------
  456|    410|	 c1 += 'a' - 'A';
  457|  2.84k|       if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (457:12): [True: 1.25k, False: 1.58k]
  |  Branch (457:25): [True: 429, False: 827]
  ------------------
  458|    429|	 c2 += 'a' - 'A';
  459|       |
  460|  2.84k|       if (c1 != c2)
  ------------------
  |  Branch (460:12): [True: 256, False: 2.58k]
  ------------------
  461|    256|	 return 0;
  462|  2.84k|    } while (ap != a);
  ------------------
  |  Branch (462:14): [True: 2.50k, False: 81]
  ------------------
  463|       |
  464|     81|  if (bp == b)
  ------------------
  |  Branch (464:7): [True: 48, False: 33]
  ------------------
  465|     48|    return 2;
  466|       |
  467|     33|  if (*(--bp) == '.')
  ------------------
  |  Branch (467:7): [True: 1, False: 32]
  ------------------
  468|      1|    return 1;
  469|       |
  470|     32|  return 0;
  471|     33|}
parse_hex:
  614|  1.17k|{
  615|  1.17k|  int done = 0, mask = 0, i = 0;
  616|  1.17k|  char *r;
  617|       |    
  618|  1.17k|  if (mac_type)
  ------------------
  |  Branch (618:7): [True: 587, False: 587]
  ------------------
  619|    587|    *mac_type = 0;
  620|       |  
  621|  8.39k|  while (!done && (maxlen == -1 || i < maxlen))
  ------------------
  |  Branch (621:10): [True: 7.85k, False: 542]
  |  Branch (621:20): [True: 0, False: 7.85k]
  |  Branch (621:36): [True: 7.84k, False: 7]
  ------------------
  622|  7.84k|    {
  623|  14.3k|      for (r = in; *r != 0 && *r != ':' && *r != '-' && *r != ' '; r++)
  ------------------
  |  Branch (623:20): [True: 13.7k, False: 556]
  |  Branch (623:31): [True: 13.3k, False: 392]
  |  Branch (623:44): [True: 12.7k, False: 645]
  |  Branch (623:57): [True: 7.10k, False: 5.64k]
  ------------------
  624|  7.10k|	if (*r != '*' && !isxdigit((unsigned char)*r))
  ------------------
  |  Branch (624:6): [True: 6.41k, False: 690]
  |  Branch (624:19): [True: 605, False: 5.80k]
  ------------------
  625|    605|	  return -1;
  626|       |      
  627|  7.23k|      if (*r == 0)
  ------------------
  |  Branch (627:11): [True: 556, False: 6.68k]
  ------------------
  628|    556|	done = 1;
  629|       |      
  630|  7.23k|      if (r != in )
  ------------------
  |  Branch (630:11): [True: 957, False: 6.28k]
  ------------------
  631|    957|	{
  632|    957|	  if (*r == '-' && i == 0 && mac_type)
  ------------------
  |  Branch (632:8): [True: 205, False: 752]
  |  Branch (632:21): [True: 32, False: 173]
  |  Branch (632:31): [True: 0, False: 32]
  ------------------
  633|      0|	   {
  634|      0|	      *r = 0;
  635|      0|	      *mac_type = strtol(in, NULL, 16);
  636|      0|	      mac_type = NULL;
  637|      0|	   }
  638|    957|	  else
  639|    957|	    {
  640|    957|	      *r = 0;
  641|    957|	      if (strcmp(in, "*") == 0)
  ------------------
  |  Branch (641:12): [True: 415, False: 542]
  ------------------
  642|    415|		{
  643|    415|		  mask = (mask << 1) | 1;
  644|    415|		  i++;
  645|    415|		}
  646|    542|	      else
  647|    542|		{
  648|    542|		  int j, bytes = (1 + (r - in))/2;
  649|  2.22k|		  for (j = 0; j < bytes; j++)
  ------------------
  |  Branch (649:17): [True: 1.72k, False: 497]
  ------------------
  650|  1.72k|		    { 
  651|  1.72k|		      char sav;
  652|  1.72k|		      if (j < bytes - 1)
  ------------------
  |  Branch (652:13): [True: 1.20k, False: 524]
  ------------------
  653|  1.20k|			{
  654|  1.20k|			  sav = in[(j+1)*2];
  655|  1.20k|			  in[(j+1)*2] = 0;
  656|  1.20k|			}
  657|       |		      /* checks above allow mix of hexdigit and *, which
  658|       |			 is illegal. */
  659|  1.72k|		      if (strchr(&in[j*2], '*'))
  ------------------
  |  Branch (659:13): [True: 20, False: 1.70k]
  ------------------
  660|     20|			return -1;
  661|  1.70k|		      out[i] = strtol(&in[j*2], NULL, 16);
  662|  1.70k|		      mask = mask << 1;
  663|  1.70k|		      if (++i == maxlen)
  ------------------
  |  Branch (663:13): [True: 25, False: 1.68k]
  ------------------
  664|     25|			break; 
  665|  1.68k|		      if (j < bytes - 1)
  ------------------
  |  Branch (665:13): [True: 1.18k, False: 497]
  ------------------
  666|  1.18k|			in[(j+1)*2] = sav;
  667|  1.68k|		    }
  668|    542|		}
  669|    957|	    }
  670|    957|	}
  671|  7.21k|      in = r+1;
  672|  7.21k|    }
  673|       |  
  674|    549|  if (wildcard_mask)
  ------------------
  |  Branch (674:7): [True: 0, False: 549]
  ------------------
  675|      0|    *wildcard_mask = mask;
  676|       |
  677|    549|  return i;
  678|  1.17k|}
wildcard_match:
  896|    587|{
  897|  2.98k|  while (*wildcard && *match)
  ------------------
  |  Branch (897:10): [True: 2.88k, False: 99]
  |  Branch (897:23): [True: 2.79k, False: 86]
  ------------------
  898|  2.79k|    {
  899|  2.79k|      if (*wildcard == '*')
  ------------------
  |  Branch (899:11): [True: 53, False: 2.74k]
  ------------------
  900|     53|        return 1;
  901|       |
  902|  2.74k|      if (*wildcard != *match)
  ------------------
  |  Branch (902:11): [True: 349, False: 2.39k]
  ------------------
  903|    349|        return 0; 
  904|       |
  905|  2.39k|      ++wildcard;
  906|  2.39k|      ++match;
  907|  2.39k|    }
  908|       |
  909|    185|  return *wildcard == *match;
  910|    587|}
wildcard_matchn:
  914|    587|{
  915|  2.98k|  while (*wildcard && *match && num)
  ------------------
  |  Branch (915:10): [True: 2.88k, False: 99]
  |  Branch (915:23): [True: 2.79k, False: 86]
  |  Branch (915:33): [True: 2.79k, False: 0]
  ------------------
  916|  2.79k|    {
  917|  2.79k|      if (*wildcard == '*')
  ------------------
  |  Branch (917:11): [True: 53, False: 2.74k]
  ------------------
  918|     53|        return 1;
  919|       |
  920|  2.74k|      if (*wildcard != *match)
  ------------------
  |  Branch (920:11): [True: 349, False: 2.39k]
  ------------------
  921|    349|        return 0; 
  922|       |
  923|  2.39k|      ++wildcard;
  924|  2.39k|      ++match;
  925|  2.39k|      --num;
  926|  2.39k|    }
  927|       |
  928|    185|  return (!num) || (*wildcard == *match);
  ------------------
  |  Branch (928:10): [True: 85, False: 100]
  |  Branch (928:20): [True: 19, False: 81]
  ------------------
  929|    587|}
whine_malloc_real:
  953|    277|{
  954|    277|  void *ret = calloc(1, size);
  955|       |  
  956|    277|  if (!ret)
  ------------------
  |  Branch (956:7): [True: 0, False: 277]
  ------------------
  957|      0|    my_syslog(LOG_ERR, _("failed to allocate %d bytes"), (int) size);
  ------------------
  |  |   91|      0|#  define _(S) (S)
  ------------------
  958|    277|  else if (daemon->log_malloc)
  ------------------
  |  |  169|    277|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (958:12): [True: 0, False: 277]
  ------------------
  959|      0|    my_syslog(LOG_INFO, _("malloc: %s:%u %zu bytes at %x"), func, line, size, hash_ptr(ret));
  ------------------
  |  |   91|      0|#  define _(S) (S)
  ------------------
                  my_syslog(LOG_INFO, _("malloc: %s:%u %zu bytes at %x"), func, line, size, hash_ptr(ret));
  ------------------
  |  |  950|      0|#define hash_ptr(x) (((uintptr_t)(x)) & 0xffffff)
  ------------------
  960|       |
  961|    277|  return ret;
  962|    277|}
free_real:
 1030|  28.3k|{
 1031|  28.3k|  if (ptr)
  ------------------
  |  Branch (1031:7): [True: 28.3k, False: 0]
  ------------------
 1032|  28.3k|    {
 1033|  28.3k|      if (daemon->log_malloc)
  ------------------
  |  |  169|  28.3k|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (1033:11): [True: 0, False: 28.3k]
  ------------------
 1034|      0|	my_syslog(LOG_INFO, _("free: %s:%u block at %x"), func, line, hash_ptr(ptr));
  ------------------
  |  |   91|      0|#  define _(S) (S)
  ------------------
              	my_syslog(LOG_INFO, _("free: %s:%u block at %x"), func, line, hash_ptr(ptr));
  ------------------
  |  |  950|      0|#define hash_ptr(x) (((uintptr_t)(x)) & 0xffffff)
  ------------------
 1035|       |  
 1036|  28.3k|      free(ptr);
 1037|  28.3k|    }
 1038|  28.3k|}
util.c:check_name:
  136|  1.17k|{
  137|       |  /* remove trailing . 
  138|       |     also fail empty string and label > 63 chars */
  139|  1.17k|  size_t dotgap = 0, wiresize = 0, l = strlen(in);
  140|  1.17k|  char c;
  141|  1.17k|  int nowhite = 0;
  142|  1.17k|  int idn_encode = 0;
  143|  1.17k|  int hasuscore = 0;
  144|  1.17k|  int hasucase = 0;
  145|       |  
  146|  1.17k|  if (l == 0)
  ------------------
  |  Branch (146:7): [True: 81, False: 1.09k]
  ------------------
  147|     81|    return 0;
  148|       |  
  149|  1.09k|  if (in[l-1] == '.')
  ------------------
  |  Branch (149:7): [True: 40, False: 1.05k]
  ------------------
  150|     40|    {
  151|     40|      in[l-1] = 0;
  152|     40|      nowhite = 1;
  153|     40|    }
  154|       |
  155|  17.5k|  for (; (c = *in); in++)
  ------------------
  |  Branch (155:10): [True: 16.8k, False: 691]
  ------------------
  156|  16.8k|    {
  157|  16.8k|      if (c == '.')
  ------------------
  |  Branch (157:11): [True: 2.04k, False: 14.7k]
  ------------------
  158|  2.04k|        {
  159|  2.04k|	  wiresize += dotgap + 1;
  160|  2.04k|	  dotgap = 0;
  161|  2.04k|	}
  162|  14.7k|      else if (++dotgap > MAXLABEL)
  ------------------
  |  |   54|  14.7k|#define MAXLABEL        63              /* maximum length of domain label */
  ------------------
  |  Branch (162:16): [True: 89, False: 14.6k]
  ------------------
  163|     89|        return 0;
  164|  14.6k|      else if (isascii((unsigned char)c) && iscntrl((unsigned char)c)) 
  ------------------
  |  Branch (164:16): [True: 14.4k, False: 238]
  |  Branch (164:45): [True: 75, False: 14.3k]
  ------------------
  165|       |        /* iscntrl only gives expected results for ascii */
  166|     75|        return 0;
  167|  14.6k|      else if (!isascii((unsigned char)c))
  ------------------
  |  Branch (167:16): [True: 238, False: 14.3k]
  ------------------
  168|    238|#if !defined(HAVE_IDN) && !defined(HAVE_LIBIDN2)
  169|    238|        return 0;
  170|       |#else
  171|       |        idn_encode = 1;
  172|       |#endif
  173|  14.3k|      else if (c != ' ')
  ------------------
  |  Branch (173:16): [True: 10.4k, False: 3.92k]
  ------------------
  174|  10.4k|        {
  175|  10.4k|          nowhite = 1;
  176|       |#if defined(HAVE_LIBIDN2) && (!defined(IDN2_VERSION_NUMBER) || IDN2_VERSION_NUMBER < 0x02000003)
  177|       |          if (c == '_')
  178|       |            hasuscore = 1;
  179|       |#else
  180|  10.4k|          (void)hasuscore;
  181|  10.4k|#endif
  182|       |
  183|       |#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
  184|       |          if (c >= 'A' && c <= 'Z')
  185|       |            hasucase = 1;
  186|       |#else
  187|  10.4k|          (void)hasucase;
  188|  10.4k|#endif
  189|  10.4k|        }
  190|  16.8k|    }
  191|       |
  192|    691|  if (!nowhite)
  ------------------
  |  Branch (192:7): [True: 81, False: 610]
  ------------------
  193|     81|    return 0;
  194|       |
  195|       |#if defined(HAVE_LIBIDN2) && (!defined(IDN2_VERSION_NUMBER) || IDN2_VERSION_NUMBER < 0x02000003)
  196|       |  /* Older libidn2 strips underscores, so don't do IDN processing
  197|       |     if the name has an underscore unless it also has non-ascii characters. */
  198|       |  idn_encode = idn_encode || (hasucase && !hasuscore);
  199|       |#else
  200|    610|  idn_encode = idn_encode || hasucase;
  ------------------
  |  Branch (200:16): [True: 0, False: 610]
  |  Branch (200:30): [True: 0, False: 610]
  ------------------
  201|    610|#endif
  202|       |
  203|       | /* length of final label and terminaton added */
  204|    610|  if (!idn_encode && wiresize + dotgap + 2 >  MAXDNAME)
  ------------------
  |  |   49|    610|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
  |  Branch (204:7): [True: 610, False: 0]
  |  Branch (204:22): [True: 5, False: 605]
  ------------------
  205|      5|    return 0; /* wire representation too long */
  206|       |
  207|    605|  return (idn_encode) ? 2 : 1;
  ------------------
  |  Branch (207:10): [True: 0, False: 605]
  ------------------
  208|    610|}

LLVMFuzzerTestOneInput:
  224|    982|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  225|    982|  FuzzedDataProvider provider(data, size);
  226|       |
  227|    982|  std::vector<void *> allocs;
  228|    982|  std::vector<std::string> strings;
  229|    982|  strings.reserve(40);
  230|       |
  231|    982|  int succ = init_daemon(provider, allocs, strings);
  232|    982|  if (succ == 0) {
  ------------------
  |  Branch (232:7): [True: 982, False: 0]
  ------------------
  233|    982|    std::string t1_str = provider.ConsumeRandomLengthString(MAXDNAME);
  ------------------
  |  |   49|    982|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
  234|    982|    std::string t2_str = provider.ConsumeRandomLengthString(MAXDNAME);
  ------------------
  |  |   49|    982|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
  235|    982|    if (t1_str.empty() || t2_str.empty())
  ------------------
  |  Branch (235:9): [True: 331, False: 651]
  |  Branch (235:27): [True: 64, False: 587]
  ------------------
  236|    395|      goto cleanup;
  237|       |
  238|    587|    char *t1 = t1_str.data();
  239|    587|    char *t2 = t2_str.data();
  240|       |
  241|       |    // Util logic
  242|    587|    hostname_isequal(t1, t2);
  243|       |
  244|    587|    legal_hostname(t1);
  245|    587|    char *tmp = canonicalise(t2, NULL);
  246|    587|    if (tmp != NULL) {
  ------------------
  |  Branch (246:9): [True: 277, False: 310]
  ------------------
  247|    277|      free(tmp);
  ------------------
  |  | 1513|    277|#define free(x) free_real(__func__, __LINE__, (x))
  ------------------
  248|    277|    }
  249|       |
  250|    587|    char *tmp_out = (char *)malloc(30);
  251|    587|    if (tmp_out) {
  ------------------
  |  Branch (251:9): [True: 587, False: 0]
  ------------------
  252|    587|      int mac_type;
  253|    587|      parse_hex(t1, (unsigned char *)tmp_out, 30, NULL, NULL);
  254|    587|      parse_hex(t1, (unsigned char *)tmp_out, 30, NULL, &mac_type);
  255|    587|      free(tmp_out);
  ------------------
  |  | 1513|    587|#define free(x) free_real(__func__, __LINE__, (x))
  ------------------
  256|    587|    }
  257|       |
  258|    587|    wildcard_match(t1, t2);
  259|    587|    if (t1_str.size() < t2_str.size()) {
  ------------------
  |  Branch (259:9): [True: 130, False: 457]
  ------------------
  260|    130|      wildcard_matchn(t1, t2, t1_str.size());
  261|    457|    } else {
  262|    457|      wildcard_matchn(t1, t2, t2_str.size());
  263|    457|    }
  264|    587|    hostname_issubdomain(t1, t2);
  265|       |
  266|    587|    union all_addr addr1;
  267|    587|    memset(&addr1, 0, sizeof(union all_addr));
  268|    587|    is_name_synthetic(0, t1, &addr1);
  269|    587|  }
  270|       |
  271|    982|cleanup:
  272|    982|  for (void *p : allocs)
  ------------------
  |  Branch (272:16): [True: 26.5k, False: 982]
  ------------------
  273|  26.5k|    free(p);
  ------------------
  |  | 1513|  26.5k|#define free(x) free_real(__func__, __LINE__, (x))
  ------------------
  274|       |  // Free daemon last since dnsmasq's free_real() dereferences it.
  275|    982|  free(daemon);
  ------------------
  |  | 1513|    982|#define free(x) free_real(__func__, __LINE__, (x))
  ------------------
  276|    982|  daemon = NULL;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  277|       |
  278|    982|  return 0;
  279|    982|}
fuzz_util.cc:_ZL11init_daemonR18FuzzedDataProviderRNSt3__16vectorIPvNS1_9allocatorIS3_EEEERNS2_INS1_12basic_stringIcNS1_11char_traitsIcEENS4_IcEEEENS4_ISC_EEEE:
   27|    982|                       std::vector<std::string> &strings) {
   28|    982|  auto alloc = [&](size_t sz) -> void * {
   29|    982|    void *p = calloc(1, sz);
   30|    982|    if (p) allocs.push_back(p);
   31|    982|    return p;
   32|    982|  };
   33|       |
   34|    982|  auto make_string = [&](size_t max_len) -> char * {
   35|    982|    strings.push_back(provider.ConsumeRandomLengthString(max_len));
   36|    982|    return strings.back().data();
   37|    982|  };
   38|       |
   39|       |  // Allocate daemon separately (not via alloc) so it can be freed last.
   40|       |  // dnsmasq's free_real() dereferences daemon for metrics tracking.
   41|    982|  daemon = (struct daemon *)calloc(1, sizeof(struct daemon));
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   42|    982|  if (!daemon) return -1;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (42:7): [True: 0, False: 982]
  ------------------
   43|       |
   44|    982|  daemon->max_ttl = provider.ConsumeIntegral<int>();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   45|    982|  daemon->neg_ttl = provider.ConsumeIntegral<int>();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   46|    982|  daemon->local_ttl = provider.ConsumeIntegral<int>();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   47|    982|  daemon->min_cache_ttl = provider.ConsumeIntegral<int>();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   48|       |
   49|    982|  daemon->namebuff = make_string(MAXDNAME);
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                daemon->namebuff = make_string(MAXDNAME);
  ------------------
  |  |   49|    982|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
   50|       |
   51|       |  // daemon->naptr
   52|    982|  struct naptr *naptr_ptr = (struct naptr *)alloc(sizeof(struct naptr));
   53|    982|  if (!naptr_ptr) return -1;
  ------------------
  |  Branch (53:7): [True: 0, False: 982]
  ------------------
   54|    982|  naptr_ptr->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   55|    982|  naptr_ptr->replace = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   56|    982|  naptr_ptr->regexp = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   57|    982|  naptr_ptr->services = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   58|    982|  naptr_ptr->flags = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   59|    982|  daemon->naptr = naptr_ptr;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   60|       |
   61|       |  // daemon->int_names
   62|    982|  struct interface_name *int_namses =
   63|    982|      (struct interface_name *)alloc(sizeof(struct interface_name));
   64|    982|  if (!int_namses) return -1;
  ------------------
  |  Branch (64:7): [True: 0, False: 982]
  ------------------
   65|    982|  int_namses->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   66|    982|  int_namses->intr = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   67|       |
   68|    982|  struct addrlist *d_addrlist = (struct addrlist *)alloc(sizeof(struct addrlist));
   69|    982|  if (!d_addrlist) return -1;
  ------------------
  |  Branch (69:7): [True: 0, False: 982]
  ------------------
   70|    982|  d_addrlist->flags = provider.ConsumeIntegral<int>();
   71|    982|  d_addrlist->prefixlen = provider.ConsumeIntegral<int>();
   72|    982|  int_namses->addr = d_addrlist;
   73|    982|  daemon->int_names = int_namses;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   74|       |
   75|       |  // daemon->addrbuf
   76|    982|  char *adbuf = (char *)alloc(200);
   77|    982|  if (!adbuf) return -1;
  ------------------
  |  Branch (77:7): [True: 0, False: 982]
  ------------------
   78|    982|  daemon->addrbuff = adbuf;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   79|       |
   80|       |  // daemon->auth_zones
   81|    982|  struct auth_zone *d_az = (struct auth_zone *)alloc(sizeof(struct auth_zone));
   82|    982|  if (!d_az) return -1;
  ------------------
  |  Branch (82:7): [True: 0, False: 982]
  ------------------
   83|    982|  d_az->domain = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   84|    982|  daemon->auth_zones = d_az;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   85|       |
   86|       |  // daemon->mxnames
   87|    982|  struct mx_srv_record *mx_srv_rec =
   88|    982|      (struct mx_srv_record *)alloc(sizeof(struct mx_srv_record));
   89|    982|  if (!mx_srv_rec) return -1;
  ------------------
  |  Branch (89:7): [True: 0, False: 982]
  ------------------
   90|    982|  mx_srv_rec->next = daemon->mxnames;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   91|    982|  daemon->mxnames = mx_srv_rec;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
   92|    982|  mx_srv_rec->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   93|    982|  mx_srv_rec->target = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
   94|    982|  mx_srv_rec->issrv = provider.ConsumeIntegral<int>();
   95|    982|  mx_srv_rec->weight = provider.ConsumeIntegral<int>();
   96|    982|  mx_srv_rec->priority = provider.ConsumeIntegral<int>();
   97|    982|  mx_srv_rec->srvport = provider.ConsumeIntegral<int>();
   98|       |
   99|       |  // daemon->txt
  100|    982|  struct txt_record *txt_record =
  101|    982|      (struct txt_record *)alloc(sizeof(struct txt_record));
  102|    982|  if (!txt_record) return -1;
  ------------------
  |  Branch (102:7): [True: 0, False: 982]
  ------------------
  103|    982|  txt_record->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  104|    982|  txt_record->txt = (unsigned char *)make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  105|    982|  txt_record->class2 = provider.ConsumeIntegralInRange<short>(0, 9);
  106|    982|  daemon->txt = txt_record;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  107|       |
  108|       |  // daemon->rr
  109|    982|  struct txt_record *rr_record =
  110|    982|      (struct txt_record *)alloc(sizeof(struct txt_record));
  111|    982|  if (!rr_record) return -1;
  ------------------
  |  Branch (111:7): [True: 0, False: 982]
  ------------------
  112|    982|  rr_record->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  113|    982|  rr_record->txt = (unsigned char *)make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  114|    982|  rr_record->class2 = provider.ConsumeIntegralInRange<short>(0, 9);
  115|    982|  daemon->rr = rr_record;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  116|       |
  117|       |  // daemon->relay4
  118|    982|  struct dhcp_relay *dr = (struct dhcp_relay *)alloc(sizeof(struct dhcp_relay));
  119|    982|  if (!dr) return -1;
  ------------------
  |  Branch (119:7): [True: 0, False: 982]
  ------------------
  120|    982|  dr->interface = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  121|    982|  dr->next = NULL;
  122|    982|  daemon->relay4 = dr;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  123|       |
  124|       |  // daemon->bridges
  125|    982|  struct dhcp_bridge *db = (struct dhcp_bridge *)alloc(sizeof(struct dhcp_bridge));
  126|    982|  if (!db) return -1;
  ------------------
  |  Branch (126:7): [True: 0, False: 982]
  ------------------
  127|    982|  {
  128|    982|    std::string iface_str = provider.ConsumeRandomLengthString(IF_NAMESIZE - 1);
  129|    982|    memcpy(db->iface, iface_str.c_str(), iface_str.size() + 1);
  130|    982|  }
  131|       |
  132|    982|  struct dhcp_bridge *db_alias =
  133|    982|      (struct dhcp_bridge *)alloc(sizeof(struct dhcp_bridge));
  134|    982|  if (!db_alias) return -1;
  ------------------
  |  Branch (134:7): [True: 0, False: 982]
  ------------------
  135|    982|  {
  136|    982|    std::string alias_str = provider.ConsumeRandomLengthString(IF_NAMESIZE - 1);
  137|    982|    memcpy(db_alias->iface, alias_str.c_str(), alias_str.size() + 1);
  138|    982|  }
  139|    982|  db->alias = db_alias;
  140|    982|  daemon->bridges = db;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  141|       |
  142|       |  // daemon->if_names, if_addrs, if_except, dhcp_except, authinterface
  143|    982|  auto make_iname = [&]() -> struct iname * {
  144|    982|    struct iname *in = (struct iname *)alloc(sizeof(struct iname));
  145|    982|    if (!in) return nullptr;
  146|    982|    in->name = make_string(STR_SIZE);
  147|    982|    in->next = NULL;
  148|    982|    return in;
  149|    982|  };
  150|       |
  151|    982|  daemon->if_names = make_iname();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  152|    982|  daemon->if_addrs = make_iname();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  153|    982|  daemon->if_except = make_iname();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  154|    982|  daemon->dhcp_except = make_iname();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  155|    982|  daemon->authinterface = make_iname();
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  156|    982|  if (!daemon->if_names || !daemon->if_addrs || !daemon->if_except ||
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                if (!daemon->if_names || !daemon->if_addrs || !daemon->if_except ||
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                if (!daemon->if_names || !daemon->if_addrs || !daemon->if_except ||
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (156:7): [True: 0, False: 982]
  |  Branch (156:28): [True: 0, False: 982]
  |  Branch (156:49): [True: 0, False: 982]
  ------------------
  157|    982|      !daemon->dhcp_except || !daemon->authinterface)
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                    !daemon->dhcp_except || !daemon->authinterface)
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (157:7): [True: 0, False: 982]
  |  Branch (157:31): [True: 0, False: 982]
  ------------------
  158|      0|    return -1;
  159|       |
  160|       |  // daemon->cnames
  161|    982|  struct cname *cn = (struct cname *)alloc(sizeof(struct cname));
  162|    982|  if (!cn) return -1;
  ------------------
  |  Branch (162:7): [True: 0, False: 982]
  ------------------
  163|    982|  cn->alias = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  164|    982|  cn->target = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  165|    982|  daemon->cnames = cn;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  166|       |
  167|       |  // daemon->ptr
  168|    982|  struct ptr_record *ptr = (struct ptr_record *)alloc(sizeof(struct ptr_record));
  169|    982|  if (!ptr) return -1;
  ------------------
  |  Branch (169:7): [True: 0, False: 982]
  ------------------
  170|    982|  ptr->name = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  171|    982|  daemon->ptr = ptr;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  172|       |
  173|       |  // daemon->dhcp
  174|    982|  struct dhcp_context *dhcp_c =
  175|    982|      (struct dhcp_context *)alloc(sizeof(struct dhcp_context));
  176|    982|  if (!dhcp_c) return -1;
  ------------------
  |  Branch (176:7): [True: 0, False: 982]
  ------------------
  177|    982|  dhcp_c->next = NULL;
  178|    982|  dhcp_c->current = NULL;
  179|    982|  struct dhcp_netid *dhcp_c_netid =
  180|    982|      (struct dhcp_netid *)alloc(sizeof(struct dhcp_netid));
  181|    982|  if (!dhcp_c_netid) return -1;
  ------------------
  |  Branch (181:7): [True: 0, False: 982]
  ------------------
  182|    982|  dhcp_c_netid->net = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  183|    982|  dhcp_c->filter = dhcp_c_netid;
  184|    982|  dhcp_c->template_interface = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  185|    982|  daemon->dhcp = dhcp_c;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  186|       |
  187|       |  // daemon->dhcp6
  188|    982|  struct dhcp_context *dhcp6_c =
  189|    982|      (struct dhcp_context *)alloc(sizeof(struct dhcp_context));
  190|    982|  if (!dhcp6_c) return -1;
  ------------------
  |  Branch (190:7): [True: 0, False: 982]
  ------------------
  191|    982|  dhcp6_c->next = NULL;
  192|    982|  dhcp6_c->current = NULL;
  193|    982|  struct dhcp_netid *dhcp6_c_netid =
  194|    982|      (struct dhcp_netid *)alloc(sizeof(struct dhcp_netid));
  195|    982|  if (!dhcp6_c_netid) return -1;
  ------------------
  |  Branch (195:7): [True: 0, False: 982]
  ------------------
  196|    982|  dhcp6_c_netid->net = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  197|    982|  dhcp6_c->filter = dhcp6_c_netid;
  198|    982|  dhcp6_c->template_interface = make_string(STR_SIZE);
  ------------------
  |  |   23|    982|#define STR_SIZE 75
  ------------------
  199|    982|  daemon->dhcp6 = dhcp6_c;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  200|       |
  201|    982|  daemon->doing_dhcp6 = 1;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  202|       |
  203|       |  // daemon->dhcp_buffs
  204|    982|  daemon->dhcp_buff = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                daemon->dhcp_buff = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |   24|    982|#define DHCP_BUFF_SZ 256
  ------------------
  205|    982|  daemon->dhcp_buff2 = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                daemon->dhcp_buff2 = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |   24|    982|#define DHCP_BUFF_SZ 256
  ------------------
  206|    982|  daemon->dhcp_buff3 = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                daemon->dhcp_buff3 = (char *)alloc(DHCP_BUFF_SZ);
  ------------------
  |  |   24|    982|#define DHCP_BUFF_SZ 256
  ------------------
  207|    982|  if (!daemon->dhcp_buff || !daemon->dhcp_buff2 || !daemon->dhcp_buff3)
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                if (!daemon->dhcp_buff || !daemon->dhcp_buff2 || !daemon->dhcp_buff3)
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
                if (!daemon->dhcp_buff || !daemon->dhcp_buff2 || !daemon->dhcp_buff3)
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (207:7): [True: 0, False: 982]
  |  Branch (207:29): [True: 0, False: 982]
  |  Branch (207:52): [True: 0, False: 982]
  ------------------
  208|      0|    return -1;
  209|       |
  210|       |  // daemon->ignore_addr
  211|    982|  struct bogus_addr *bb = (struct bogus_addr *)alloc(sizeof(struct bogus_addr));
  212|    982|  if (!bb) return -1;
  ------------------
  |  Branch (212:7): [True: 0, False: 982]
  ------------------
  213|    982|  daemon->ignore_addr = bb;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  214|       |
  215|       |  // daemon->doctors
  216|    982|  struct doctor *doctors = (struct doctor *)alloc(sizeof(struct doctor));
  217|    982|  if (!doctors) return -1;
  ------------------
  |  Branch (217:7): [True: 0, False: 982]
  ------------------
  218|    982|  doctors->next = NULL;
  219|    982|  daemon->doctors = doctors;
  ------------------
  |  |  169|    982|#define daemon dnsmasq_daemon
  ------------------
  220|       |
  221|    982|  return 0;
  222|    982|}
fuzz_util.cc:_ZZL11init_daemonR18FuzzedDataProviderRNSt3__16vectorIPvNS1_9allocatorIS3_EEEERNS2_INS1_12basic_stringIcNS1_11char_traitsIcEENS4_IcEEEENS4_ISC_EEEEENK3$_1clEm:
   34|  27.4k|  auto make_string = [&](size_t max_len) -> char * {
   35|  27.4k|    strings.push_back(provider.ConsumeRandomLengthString(max_len));
   36|  27.4k|    return strings.back().data();
   37|  27.4k|  };
fuzz_util.cc:_ZZL11init_daemonR18FuzzedDataProviderRNSt3__16vectorIPvNS1_9allocatorIS3_EEEERNS2_INS1_12basic_stringIcNS1_11char_traitsIcEENS4_IcEEEENS4_ISC_EEEEENK3$_0clEm:
   28|  26.5k|  auto alloc = [&](size_t sz) -> void * {
   29|  26.5k|    void *p = calloc(1, sz);
   30|  26.5k|    if (p) allocs.push_back(p);
  ------------------
  |  Branch (30:9): [True: 26.5k, False: 0]
  ------------------
   31|  26.5k|    return p;
   32|  26.5k|  };
fuzz_util.cc:_ZZL11init_daemonR18FuzzedDataProviderRNSt3__16vectorIPvNS1_9allocatorIS3_EEEERNS2_INS1_12basic_stringIcNS1_11char_traitsIcEENS4_IcEEEENS4_ISC_EEEEENK3$_2clEv:
  143|  4.91k|  auto make_iname = [&]() -> struct iname * {
  144|  4.91k|    struct iname *in = (struct iname *)alloc(sizeof(struct iname));
  145|  4.91k|    if (!in) return nullptr;
  ------------------
  |  Branch (145:9): [True: 0, False: 4.91k]
  ------------------
  146|  4.91k|    in->name = make_string(STR_SIZE);
  ------------------
  |  |   23|  4.91k|#define STR_SIZE 75
  ------------------
  147|       |    in->next = NULL;
  148|  4.91k|    return in;
  149|  4.91k|  };

