is_name_synthetic:
   26|    576|{
   27|    576|  char *p;
   28|    576|  struct cond_domain *c = NULL;
   29|    576|  int prot = (flags & F_IPV6) ? AF_INET6 : AF_INET;
  ------------------
  |  |  523|    576|#define F_IPV6      (1u<<8)
  ------------------
  |  Branch (29:14): [True: 0, False: 576]
  ------------------
   30|    576|  union all_addr addr;
   31|       |  
   32|    576|  for (c = daemon->synth_domains; c; c = c->next)
  ------------------
  |  |  169|    576|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (32:35): [True: 0, False: 576]
  ------------------
   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|    576|  return 0;
  150|    576|}

legal_hostname:
  215|    576|{
  216|    576|  char c;
  217|    576|  int first;
  218|       |
  219|    576|  if (!check_name(name))
  ------------------
  |  Branch (219:7): [True: 257, False: 319]
  ------------------
  220|    257|    return 0;
  221|       |
  222|  1.51k|  for (first = 1; (c = *name); name++, first = 0)
  ------------------
  |  Branch (222:19): [True: 1.36k, False: 145]
  ------------------
  223|       |    /* check for legal char a-z A-Z 0-9 - _ . */
  224|  1.36k|    {
  225|  1.36k|      if ((c >= 'A' && c <= 'Z') ||
  ------------------
  |  Branch (225:12): [True: 677, False: 691]
  |  Branch (225:24): [True: 272, False: 405]
  ------------------
  226|  1.09k|	  (c >= 'a' && c <= 'z') ||
  ------------------
  |  Branch (226:5): [True: 314, False: 782]
  |  Branch (226:17): [True: 306, False: 8]
  ------------------
  227|    790|	  (c >= '0' && c <= '9'))
  ------------------
  |  Branch (227:5): [True: 531, False: 259]
  |  Branch (227:17): [True: 408, False: 123]
  ------------------
  228|    986|	continue;
  229|       |
  230|    382|      if (!first && (c == '-' || c == '_'))
  ------------------
  |  Branch (230:11): [True: 251, False: 131]
  |  Branch (230:22): [True: 139, False: 112]
  |  Branch (230:34): [True: 69, False: 43]
  ------------------
  231|    208|	continue;
  232|       |      
  233|       |      /* end of hostname part */
  234|    174|      if (c == '.')
  ------------------
  |  Branch (234:11): [True: 9, False: 165]
  ------------------
  235|      9|	return 1;
  236|       |      
  237|    165|      return 0;
  238|    174|    }
  239|       |  
  240|    145|  return 1;
  241|    319|}
canonicalise:
  244|    576|{
  245|    576|  char *ret = NULL;
  246|    576|  int rc;
  247|       |  
  248|    576|  if (nomem)
  ------------------
  |  Branch (248:7): [True: 0, False: 576]
  ------------------
  249|      0|    *nomem = 0;
  250|       |  
  251|    576|  if (!(rc = check_name(in)))
  ------------------
  |  Branch (251:7): [True: 320, False: 256]
  ------------------
  252|    320|    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|    256|  (void)rc;
  284|    256|#endif
  285|       |  
  286|    256|  if ((ret = whine_malloc(strlen(in)+1)))
  ------------------
  |  | 1509|    256|#define whine_malloc(x) whine_malloc_real(__func__, __LINE__, (x))
  ------------------
  |  Branch (286:7): [True: 256, False: 0]
  ------------------
  287|    256|    strcpy(ret, in);
  288|      0|  else if (nomem)
  ------------------
  |  Branch (288:12): [True: 0, False: 0]
  ------------------
  289|      0|    *nomem = 1;
  290|       |
  291|    256|  return ret;
  292|    576|}
hostname_order:
  405|    159|{
  406|    159|  unsigned int c1, c2;
  407|       |  
  408|  6.55k|  do {
  409|  6.55k|    c1 = (unsigned char) *a++;
  410|  6.55k|    c2 = (unsigned char) *b++;
  411|       |    
  412|  6.55k|    if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (412:9): [True: 4.98k, False: 1.56k]
  |  Branch (412:22): [True: 398, False: 4.59k]
  ------------------
  413|    398|      c1 += 'a' - 'A';
  414|  6.55k|    if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (414:9): [True: 4.98k, False: 1.57k]
  |  Branch (414:22): [True: 399, False: 4.58k]
  ------------------
  415|    399|      c2 += 'a' - 'A';
  416|       |    
  417|  6.55k|    if (c1 < c2)
  ------------------
  |  Branch (417:9): [True: 45, False: 6.51k]
  ------------------
  418|     45|      return -1;
  419|  6.51k|    else if (c1 > c2)
  ------------------
  |  Branch (419:14): [True: 52, False: 6.46k]
  ------------------
  420|     52|      return 1;
  421|       |    
  422|  6.55k|  } while (c1);
  ------------------
  |  Branch (422:12): [True: 6.39k, False: 62]
  ------------------
  423|       |  
  424|     62|  return 0;
  425|    159|}
hostname_isequal:
  428|    576|{
  429|    576|  return strlen(a) == strlen(b) && hostname_order(a, b) == 0;
  ------------------
  |  Branch (429:10): [True: 159, False: 417]
  |  Branch (429:36): [True: 62, False: 97]
  ------------------
  430|    576|}
hostname_issubdomain:
  434|    576|{
  435|    576|  char *ap, *bp;
  436|    576|  unsigned int c1, c2;
  437|       |  
  438|       |  /* move to the end */
  439|  13.9k|  for (ap = a; *ap; ap++); 
  ------------------
  |  Branch (439:16): [True: 13.3k, False: 576]
  ------------------
  440|  22.2k|  for (bp = b; *bp; bp++);
  ------------------
  |  Branch (440:16): [True: 21.6k, False: 576]
  ------------------
  441|       |
  442|       |  /* anything is a subdomain of the root domain. */
  443|    576|  if (ap == a)
  ------------------
  |  Branch (443:7): [True: 33, False: 543]
  ------------------
  444|     33|    return (bp == b) ? 2 : 1;
  ------------------
  |  Branch (444:12): [True: 9, False: 24]
  ------------------
  445|       |  
  446|       |  /* b shorter than a */
  447|    543|  if ((bp - b) < (ap - a))
  ------------------
  |  Branch (447:7): [True: 227, False: 316]
  ------------------
  448|    227|    return 0;
  449|       |  
  450|    316|  do
  451|  3.50k|    {
  452|  3.50k|      c1 = (unsigned char) *(--ap);
  453|  3.50k|      c2 = (unsigned char) *(--bp);
  454|       |  
  455|  3.50k|       if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (455:12): [True: 1.99k, False: 1.51k]
  |  Branch (455:25): [True: 292, False: 1.70k]
  ------------------
  456|    292|	 c1 += 'a' - 'A';
  457|  3.50k|       if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (457:12): [True: 2.01k, False: 1.49k]
  |  Branch (457:25): [True: 290, False: 1.72k]
  ------------------
  458|    290|	 c2 += 'a' - 'A';
  459|       |
  460|  3.50k|       if (c1 != c2)
  ------------------
  |  Branch (460:12): [True: 212, False: 3.29k]
  ------------------
  461|    212|	 return 0;
  462|  3.50k|    } while (ap != a);
  ------------------
  |  Branch (462:14): [True: 3.18k, False: 104]
  ------------------
  463|       |
  464|    104|  if (bp == b)
  ------------------
  |  Branch (464:7): [True: 46, False: 58]
  ------------------
  465|     46|    return 2;
  466|       |
  467|     58|  if (*(--bp) == '.')
  ------------------
  |  Branch (467:7): [True: 6, False: 52]
  ------------------
  468|      6|    return 1;
  469|       |
  470|     52|  return 0;
  471|     58|}
parse_hex:
  614|  1.15k|{
  615|  1.15k|  int done = 0, mask = 0, i = 0;
  616|  1.15k|  char *r;
  617|       |    
  618|  1.15k|  if (mac_type)
  ------------------
  |  Branch (618:7): [True: 576, False: 576]
  ------------------
  619|    576|    *mac_type = 0;
  620|       |  
  621|  7.00k|  while (!done && (maxlen == -1 || i < maxlen))
  ------------------
  |  Branch (621:10): [True: 6.44k, False: 562]
  |  Branch (621:20): [True: 0, False: 6.44k]
  |  Branch (621:36): [True: 6.44k, False: 5]
  ------------------
  622|  6.44k|    {
  623|  18.2k|      for (r = in; *r != 0 && *r != ':' && *r != '-' && *r != ' '; r++)
  ------------------
  |  Branch (623:20): [True: 17.6k, False: 581]
  |  Branch (623:31): [True: 16.9k, False: 659]
  |  Branch (623:44): [True: 16.0k, False: 939]
  |  Branch (623:57): [True: 12.3k, False: 3.70k]
  ------------------
  624|  12.3k|	if (*r != '*' && !isxdigit((unsigned char)*r))
  ------------------
  |  Branch (624:6): [True: 11.4k, False: 905]
  |  Branch (624:19): [True: 561, False: 10.8k]
  ------------------
  625|    561|	  return -1;
  626|       |      
  627|  5.88k|      if (*r == 0)
  ------------------
  |  Branch (627:11): [True: 581, False: 5.29k]
  ------------------
  628|    581|	done = 1;
  629|       |      
  630|  5.88k|      if (r != in )
  ------------------
  |  Branch (630:11): [True: 878, False: 5.00k]
  ------------------
  631|    878|	{
  632|    878|	  if (*r == '-' && i == 0 && mac_type)
  ------------------
  |  Branch (632:8): [True: 273, False: 605]
  |  Branch (632:21): [True: 45, False: 228]
  |  Branch (632:31): [True: 0, False: 45]
  ------------------
  633|      0|	   {
  634|      0|	      *r = 0;
  635|      0|	      *mac_type = strtol(in, NULL, 16);
  636|      0|	      mac_type = NULL;
  637|      0|	   }
  638|    878|	  else
  639|    878|	    {
  640|    878|	      *r = 0;
  641|    878|	      if (strcmp(in, "*") == 0)
  ------------------
  |  Branch (641:12): [True: 396, False: 482]
  ------------------
  642|    396|		{
  643|    396|		  mask = (mask << 1) | 1;
  644|    396|		  i++;
  645|    396|		}
  646|    482|	      else
  647|    482|		{
  648|    482|		  int j, bytes = (1 + (r - in))/2;
  649|  3.11k|		  for (j = 0; j < bytes; j++)
  ------------------
  |  Branch (649:17): [True: 2.71k, False: 396]
  ------------------
  650|  2.71k|		    { 
  651|  2.71k|		      char sav;
  652|  2.71k|		      if (j < bytes - 1)
  ------------------
  |  Branch (652:13): [True: 2.27k, False: 443]
  ------------------
  653|  2.27k|			{
  654|  2.27k|			  sav = in[(j+1)*2];
  655|  2.27k|			  in[(j+1)*2] = 0;
  656|  2.27k|			}
  657|       |		      /* checks above allow mix of hexdigit and *, which
  658|       |			 is illegal. */
  659|  2.71k|		      if (strchr(&in[j*2], '*'))
  ------------------
  |  Branch (659:13): [True: 24, False: 2.69k]
  ------------------
  660|     24|			return -1;
  661|  2.69k|		      out[i] = strtol(&in[j*2], NULL, 16);
  662|  2.69k|		      mask = mask << 1;
  663|  2.69k|		      if (++i == maxlen)
  ------------------
  |  Branch (663:13): [True: 62, False: 2.63k]
  ------------------
  664|     62|			break; 
  665|  2.63k|		      if (j < bytes - 1)
  ------------------
  |  Branch (665:13): [True: 2.23k, False: 396]
  ------------------
  666|  2.23k|			in[(j+1)*2] = sav;
  667|  2.63k|		    }
  668|    482|		}
  669|    878|	    }
  670|    878|	}
  671|  5.85k|      in = r+1;
  672|  5.85k|    }
  673|       |  
  674|    567|  if (wildcard_mask)
  ------------------
  |  Branch (674:7): [True: 0, False: 567]
  ------------------
  675|      0|    *wildcard_mask = mask;
  676|       |
  677|    567|  return i;
  678|  1.15k|}
wildcard_match:
  896|    576|{
  897|  4.05k|  while (*wildcard && *match)
  ------------------
  |  Branch (897:10): [True: 3.92k, False: 130]
  |  Branch (897:23): [True: 3.82k, False: 100]
  ------------------
  898|  3.82k|    {
  899|  3.82k|      if (*wildcard == '*')
  ------------------
  |  Branch (899:11): [True: 52, False: 3.76k]
  ------------------
  900|     52|        return 1;
  901|       |
  902|  3.76k|      if (*wildcard != *match)
  ------------------
  |  Branch (902:11): [True: 294, False: 3.47k]
  ------------------
  903|    294|        return 0; 
  904|       |
  905|  3.47k|      ++wildcard;
  906|  3.47k|      ++match;
  907|  3.47k|    }
  908|       |
  909|    230|  return *wildcard == *match;
  910|    576|}
wildcard_matchn:
  914|    576|{
  915|  4.05k|  while (*wildcard && *match && num)
  ------------------
  |  Branch (915:10): [True: 3.92k, False: 130]
  |  Branch (915:23): [True: 3.82k, False: 100]
  |  Branch (915:33): [True: 3.82k, False: 0]
  ------------------
  916|  3.82k|    {
  917|  3.82k|      if (*wildcard == '*')
  ------------------
  |  Branch (917:11): [True: 52, False: 3.76k]
  ------------------
  918|     52|        return 1;
  919|       |
  920|  3.76k|      if (*wildcard != *match)
  ------------------
  |  Branch (920:11): [True: 294, False: 3.47k]
  ------------------
  921|    294|        return 0; 
  922|       |
  923|  3.47k|      ++wildcard;
  924|  3.47k|      ++match;
  925|  3.47k|      --num;
  926|  3.47k|    }
  927|       |
  928|    230|  return (!num) || (*wildcard == *match);
  ------------------
  |  Branch (928:10): [True: 99, False: 131]
  |  Branch (928:20): [True: 13, False: 118]
  ------------------
  929|    576|}
whine_malloc_real:
  953|    256|{
  954|    256|  void *ret = calloc(1, size);
  955|       |  
  956|    256|  if (!ret)
  ------------------
  |  Branch (956:7): [True: 0, False: 256]
  ------------------
  957|      0|    my_syslog(LOG_ERR, _("failed to allocate %d bytes"), (int) size);
  ------------------
  |  |   91|      0|#  define _(S) (S)
  ------------------
  958|    256|  else if (daemon->log_malloc)
  ------------------
  |  |  169|    256|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (958:12): [True: 0, False: 256]
  ------------------
  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|    256|  return ret;
  962|    256|}
free_real:
 1030|  28.6k|{
 1031|  28.6k|  if (ptr)
  ------------------
  |  Branch (1031:7): [True: 28.6k, False: 0]
  ------------------
 1032|  28.6k|    {
 1033|  28.6k|      if (daemon->log_malloc)
  ------------------
  |  |  169|  28.6k|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (1033:11): [True: 0, False: 28.6k]
  ------------------
 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.6k|      free(ptr);
 1037|  28.6k|    }
 1038|  28.6k|}
util.c:check_name:
  136|  1.15k|{
  137|       |  /* remove trailing . 
  138|       |     also fail empty string and label > 63 chars */
  139|  1.15k|  size_t dotgap = 0, wiresize = 0, l = strlen(in);
  140|  1.15k|  char c;
  141|  1.15k|  int nowhite = 0;
  142|  1.15k|  int idn_encode = 0;
  143|  1.15k|  int hasuscore = 0;
  144|  1.15k|  int hasucase = 0;
  145|       |  
  146|  1.15k|  if (l == 0)
  ------------------
  |  Branch (146:7): [True: 87, False: 1.06k]
  ------------------
  147|     87|    return 0;
  148|       |  
  149|  1.06k|  if (in[l-1] == '.')
  ------------------
  |  Branch (149:7): [True: 36, False: 1.02k]
  ------------------
  150|     36|    {
  151|     36|      in[l-1] = 0;
  152|     36|      nowhite = 1;
  153|     36|    }
  154|       |
  155|  19.4k|  for (; (c = *in); in++)
  ------------------
  |  Branch (155:10): [True: 18.7k, False: 676]
  ------------------
  156|  18.7k|    {
  157|  18.7k|      if (c == '.')
  ------------------
  |  Branch (157:11): [True: 2.02k, False: 16.7k]
  ------------------
  158|  2.02k|        {
  159|  2.02k|	  wiresize += dotgap + 1;
  160|  2.02k|	  dotgap = 0;
  161|  2.02k|	}
  162|  16.7k|      else if (++dotgap > MAXLABEL)
  ------------------
  |  |   54|  16.7k|#define MAXLABEL        63              /* maximum length of domain label */
  ------------------
  |  Branch (162:16): [True: 101, False: 16.6k]
  ------------------
  163|    101|        return 0;
  164|  16.6k|      else if (isascii((unsigned char)c) && iscntrl((unsigned char)c)) 
  ------------------
  |  Branch (164:16): [True: 16.3k, False: 221]
  |  Branch (164:45): [True: 67, False: 16.3k]
  ------------------
  165|       |        /* iscntrl only gives expected results for ascii */
  166|     67|        return 0;
  167|  16.5k|      else if (!isascii((unsigned char)c))
  ------------------
  |  Branch (167:16): [True: 221, False: 16.3k]
  ------------------
  168|    221|#if !defined(HAVE_IDN) && !defined(HAVE_LIBIDN2)
  169|    221|        return 0;
  170|       |#else
  171|       |        idn_encode = 1;
  172|       |#endif
  173|  16.3k|      else if (c != ' ')
  ------------------
  |  Branch (173:16): [True: 11.7k, False: 4.58k]
  ------------------
  174|  11.7k|        {
  175|  11.7k|          nowhite = 1;
  176|       |#if defined(HAVE_LIBIDN2) && (!defined(IDN2_VERSION_NUMBER) || IDN2_VERSION_NUMBER < 0x02000003)
  177|       |          if (c == '_')
  178|       |            hasuscore = 1;
  179|       |#else
  180|  11.7k|          (void)hasuscore;
  181|  11.7k|#endif
  182|       |
  183|       |#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
  184|       |          if (c >= 'A' && c <= 'Z')
  185|       |            hasucase = 1;
  186|       |#else
  187|  11.7k|          (void)hasucase;
  188|  11.7k|#endif
  189|  11.7k|        }
  190|  18.7k|    }
  191|       |
  192|    676|  if (!nowhite)
  ------------------
  |  Branch (192:7): [True: 91, False: 585]
  ------------------
  193|     91|    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|    585|  idn_encode = idn_encode || hasucase;
  ------------------
  |  Branch (200:16): [True: 0, False: 585]
  |  Branch (200:30): [True: 0, False: 585]
  ------------------
  201|    585|#endif
  202|       |
  203|       | /* length of final label and terminaton added */
  204|    585|  if (!idn_encode && wiresize + dotgap + 2 >  MAXDNAME)
  ------------------
  |  |   49|    585|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
  |  Branch (204:7): [True: 585, False: 0]
  |  Branch (204:22): [True: 10, False: 575]
  ------------------
  205|     10|    return 0; /* wire representation too long */
  206|       |
  207|    575|  return (idn_encode) ? 2 : 1;
  ------------------
  |  Branch (207:10): [True: 0, False: 575]
  ------------------
  208|    585|}

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

