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

legal_hostname:
  215|    558|{
  216|    558|  char c;
  217|    558|  int first;
  218|       |
  219|    558|  if (!check_name(name))
  ------------------
  |  Branch (219:7): [True: 221, False: 337]
  ------------------
  220|    221|    return 0;
  221|       |
  222|  2.04k|  for (first = 1; (c = *name); name++, first = 0)
  ------------------
  |  Branch (222:19): [True: 1.88k, False: 158]
  ------------------
  223|       |    /* check for legal char a-z A-Z 0-9 - _ . */
  224|  1.88k|    {
  225|  1.88k|      if ((c >= 'A' && c <= 'Z') ||
  ------------------
  |  Branch (225:12): [True: 804, False: 1.08k]
  |  Branch (225:24): [True: 304, False: 500]
  ------------------
  226|  1.58k|	  (c >= 'a' && c <= 'z') ||
  ------------------
  |  Branch (226:5): [True: 400, False: 1.18k]
  |  Branch (226:17): [True: 390, False: 10]
  ------------------
  227|  1.19k|	  (c >= '0' && c <= '9'))
  ------------------
  |  Branch (227:5): [True: 709, False: 484]
  |  Branch (227:17): [True: 570, False: 139]
  ------------------
  228|  1.26k|	continue;
  229|       |
  230|    623|      if (!first && (c == '-' || c == '_'))
  ------------------
  |  Branch (230:11): [True: 492, False: 131]
  |  Branch (230:22): [True: 363, False: 129]
  |  Branch (230:34): [True: 81, False: 48]
  ------------------
  231|    444|	continue;
  232|       |      
  233|       |      /* end of hostname part */
  234|    179|      if (c == '.')
  ------------------
  |  Branch (234:11): [True: 15, False: 164]
  ------------------
  235|     15|	return 1;
  236|       |      
  237|    164|      return 0;
  238|    179|    }
  239|       |  
  240|    158|  return 1;
  241|    337|}
canonicalise:
  244|    558|{
  245|    558|  char *ret = NULL;
  246|    558|  int rc;
  247|       |  
  248|    558|  if (nomem)
  ------------------
  |  Branch (248:7): [True: 0, False: 558]
  ------------------
  249|      0|    *nomem = 0;
  250|       |  
  251|    558|  if (!(rc = check_name(in)))
  ------------------
  |  Branch (251:7): [True: 313, False: 245]
  ------------------
  252|    313|    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|    245|  (void)rc;
  284|    245|#endif
  285|       |  
  286|    245|  if ((ret = whine_malloc(strlen(in)+1)))
  ------------------
  |  | 1510|    245|#define whine_malloc(x) whine_malloc_real(__func__, __LINE__, (x))
  ------------------
  |  Branch (286:7): [True: 245, False: 0]
  ------------------
  287|    245|    strcpy(ret, in);
  288|      0|  else if (nomem)
  ------------------
  |  Branch (288:12): [True: 0, False: 0]
  ------------------
  289|      0|    *nomem = 1;
  290|       |
  291|    245|  return ret;
  292|    558|}
hostname_order:
  405|    163|{
  406|    163|  unsigned int c1, c2;
  407|       |  
  408|  4.80k|  do {
  409|  4.80k|    c1 = (unsigned char) *a++;
  410|  4.80k|    c2 = (unsigned char) *b++;
  411|       |    
  412|  4.80k|    if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (412:9): [True: 3.02k, False: 1.77k]
  |  Branch (412:22): [True: 245, False: 2.78k]
  ------------------
  413|    245|      c1 += 'a' - 'A';
  414|  4.80k|    if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (414:9): [True: 3.03k, False: 1.76k]
  |  Branch (414:22): [True: 283, False: 2.75k]
  ------------------
  415|    283|      c2 += 'a' - 'A';
  416|       |    
  417|  4.80k|    if (c1 < c2)
  ------------------
  |  Branch (417:9): [True: 44, False: 4.75k]
  ------------------
  418|     44|      return -1;
  419|  4.75k|    else if (c1 > c2)
  ------------------
  |  Branch (419:14): [True: 59, False: 4.69k]
  ------------------
  420|     59|      return 1;
  421|       |    
  422|  4.80k|  } while (c1);
  ------------------
  |  Branch (422:12): [True: 4.63k, False: 60]
  ------------------
  423|       |  
  424|     60|  return 0;
  425|    163|}
hostname_isequal:
  428|    558|{
  429|    558|  return strlen(a) == strlen(b) && hostname_order(a, b) == 0;
  ------------------
  |  Branch (429:10): [True: 163, False: 395]
  |  Branch (429:36): [True: 60, False: 103]
  ------------------
  430|    558|}
hostname_issubdomain:
  434|    558|{
  435|    558|  char *ap, *bp;
  436|    558|  unsigned int c1, c2;
  437|       |  
  438|       |  /* move to the end */
  439|  15.5k|  for (ap = a; *ap; ap++); 
  ------------------
  |  Branch (439:16): [True: 14.9k, False: 558]
  ------------------
  440|  18.9k|  for (bp = b; *bp; bp++);
  ------------------
  |  Branch (440:16): [True: 18.3k, False: 558]
  ------------------
  441|       |
  442|       |  /* anything is a subdomain of the root domain. */
  443|    558|  if (ap == a)
  ------------------
  |  Branch (443:7): [True: 43, False: 515]
  ------------------
  444|     43|    return (bp == b) ? 2 : 1;
  ------------------
  |  Branch (444:12): [True: 13, False: 30]
  ------------------
  445|       |  
  446|       |  /* b shorter than a */
  447|    515|  if ((bp - b) < (ap - a))
  ------------------
  |  Branch (447:7): [True: 213, False: 302]
  ------------------
  448|    213|    return 0;
  449|       |  
  450|    302|  do
  451|  3.67k|    {
  452|  3.67k|      c1 = (unsigned char) *(--ap);
  453|  3.67k|      c2 = (unsigned char) *(--bp);
  454|       |  
  455|  3.67k|       if (c1 >= 'A' && c1 <= 'Z')
  ------------------
  |  Branch (455:12): [True: 2.17k, False: 1.49k]
  |  Branch (455:25): [True: 252, False: 1.92k]
  ------------------
  456|    252|	 c1 += 'a' - 'A';
  457|  3.67k|       if (c2 >= 'A' && c2 <= 'Z')
  ------------------
  |  Branch (457:12): [True: 2.20k, False: 1.46k]
  |  Branch (457:25): [True: 298, False: 1.90k]
  ------------------
  458|    298|	 c2 += 'a' - 'A';
  459|       |
  460|  3.67k|       if (c1 != c2)
  ------------------
  |  Branch (460:12): [True: 210, False: 3.46k]
  ------------------
  461|    210|	 return 0;
  462|  3.67k|    } while (ap != a);
  ------------------
  |  Branch (462:14): [True: 3.36k, False: 92]
  ------------------
  463|       |
  464|     92|  if (bp == b)
  ------------------
  |  Branch (464:7): [True: 42, False: 50]
  ------------------
  465|     42|    return 2;
  466|       |
  467|     50|  if (*(--bp) == '.')
  ------------------
  |  Branch (467:7): [True: 4, False: 46]
  ------------------
  468|      4|    return 1;
  469|       |
  470|     46|  return 0;
  471|     50|}
parse_hex:
  614|  1.11k|{
  615|  1.11k|  int done = 0, mask = 0, i = 0;
  616|  1.11k|  char *r;
  617|       |    
  618|  1.11k|  if (mac_type)
  ------------------
  |  Branch (618:7): [True: 558, False: 558]
  ------------------
  619|    558|    *mac_type = 0;
  620|       |  
  621|  6.74k|  while (!done && (maxlen == -1 || i < maxlen))
  ------------------
  |  Branch (621:10): [True: 6.18k, False: 565]
  |  Branch (621:20): [True: 0, False: 6.18k]
  |  Branch (621:36): [True: 6.17k, False: 4]
  ------------------
  622|  6.17k|    {
  623|  16.9k|      for (r = in; *r != 0 && *r != ':' && *r != '-' && *r != ' '; r++)
  ------------------
  |  Branch (623:20): [True: 16.4k, False: 576]
  |  Branch (623:31): [True: 15.7k, False: 634]
  |  Branch (623:44): [True: 14.7k, False: 1.05k]
  |  Branch (623:57): [True: 11.3k, False: 3.37k]
  ------------------
  624|  11.3k|	if (*r != '*' && !isxdigit((unsigned char)*r))
  ------------------
  |  Branch (624:6): [True: 10.5k, False: 768]
  |  Branch (624:19): [True: 535, False: 10.0k]
  ------------------
  625|    535|	  return -1;
  626|       |      
  627|  5.64k|      if (*r == 0)
  ------------------
  |  Branch (627:11): [True: 576, False: 5.06k]
  ------------------
  628|    576|	done = 1;
  629|       |      
  630|  5.64k|      if (r != in )
  ------------------
  |  Branch (630:11): [True: 780, False: 4.86k]
  ------------------
  631|    780|	{
  632|    780|	  if (*r == '-' && i == 0 && mac_type)
  ------------------
  |  Branch (632:8): [True: 201, False: 579]
  |  Branch (632:21): [True: 46, False: 155]
  |  Branch (632:31): [True: 0, False: 46]
  ------------------
  633|      0|	   {
  634|      0|	      *r = 0;
  635|      0|	      *mac_type = strtol(in, NULL, 16);
  636|      0|	      mac_type = NULL;
  637|      0|	   }
  638|    780|	  else
  639|    780|	    {
  640|    780|	      *r = 0;
  641|    780|	      if (strcmp(in, "*") == 0)
  ------------------
  |  Branch (641:12): [True: 308, False: 472]
  ------------------
  642|    308|		{
  643|    308|		  mask = (mask << 1) | 1;
  644|    308|		  i++;
  645|    308|		}
  646|    472|	      else
  647|    472|		{
  648|    472|		  int j, bytes = (1 + (r - in))/2;
  649|  2.67k|		  for (j = 0; j < bytes; j++)
  ------------------
  |  Branch (649:17): [True: 2.26k, False: 416]
  ------------------
  650|  2.26k|		    { 
  651|  2.26k|		      char sav;
  652|  2.26k|		      if (j < bytes - 1)
  ------------------
  |  Branch (652:13): [True: 1.81k, False: 448]
  ------------------
  653|  1.81k|			{
  654|  1.81k|			  sav = in[(j+1)*2];
  655|  1.81k|			  in[(j+1)*2] = 0;
  656|  1.81k|			}
  657|       |		      /* checks above allow mix of hexdigit and *, which
  658|       |			 is illegal. */
  659|  2.26k|		      if (strchr(&in[j*2], '*'))
  ------------------
  |  Branch (659:13): [True: 12, False: 2.24k]
  ------------------
  660|     12|			return -1;
  661|  2.24k|		      out[i] = strtol(&in[j*2], NULL, 16);
  662|  2.24k|		      mask = mask << 1;
  663|  2.24k|		      if (++i == maxlen)
  ------------------
  |  Branch (663:13): [True: 44, False: 2.20k]
  ------------------
  664|     44|			break; 
  665|  2.20k|		      if (j < bytes - 1)
  ------------------
  |  Branch (665:13): [True: 1.78k, False: 416]
  ------------------
  666|  1.78k|			in[(j+1)*2] = sav;
  667|  2.20k|		    }
  668|    472|		}
  669|    780|	    }
  670|    780|	}
  671|  5.63k|      in = r+1;
  672|  5.63k|    }
  673|       |  
  674|    569|  if (wildcard_mask)
  ------------------
  |  Branch (674:7): [True: 0, False: 569]
  ------------------
  675|      0|    *wildcard_mask = mask;
  676|       |
  677|    569|  return i;
  678|  1.11k|}
wildcard_match:
  896|    558|{
  897|  4.23k|  while (*wildcard && *match)
  ------------------
  |  Branch (897:10): [True: 4.12k, False: 116]
  |  Branch (897:23): [True: 4.02k, False: 99]
  ------------------
  898|  4.02k|    {
  899|  4.02k|      if (*wildcard == '*')
  ------------------
  |  Branch (899:11): [True: 48, False: 3.97k]
  ------------------
  900|     48|        return 1;
  901|       |
  902|  3.97k|      if (*wildcard != *match)
  ------------------
  |  Branch (902:11): [True: 295, False: 3.68k]
  ------------------
  903|    295|        return 0; 
  904|       |
  905|  3.68k|      ++wildcard;
  906|  3.68k|      ++match;
  907|  3.68k|    }
  908|       |
  909|    215|  return *wildcard == *match;
  910|    558|}
wildcard_matchn:
  914|    558|{
  915|  4.23k|  while (*wildcard && *match && num)
  ------------------
  |  Branch (915:10): [True: 4.12k, False: 116]
  |  Branch (915:23): [True: 4.02k, False: 99]
  |  Branch (915:33): [True: 4.02k, False: 0]
  ------------------
  916|  4.02k|    {
  917|  4.02k|      if (*wildcard == '*')
  ------------------
  |  Branch (917:11): [True: 48, False: 3.97k]
  ------------------
  918|     48|        return 1;
  919|       |
  920|  3.97k|      if (*wildcard != *match)
  ------------------
  |  Branch (920:11): [True: 295, False: 3.68k]
  ------------------
  921|    295|        return 0; 
  922|       |
  923|  3.68k|      ++wildcard;
  924|  3.68k|      ++match;
  925|  3.68k|      --num;
  926|  3.68k|    }
  927|       |
  928|    215|  return (!num) || (*wildcard == *match);
  ------------------
  |  Branch (928:10): [True: 86, False: 129]
  |  Branch (928:20): [True: 15, False: 114]
  ------------------
  929|    558|}
whine_malloc_real:
  953|    245|{
  954|    245|  void *ret = calloc(1, size);
  955|       |  
  956|    245|  if (!ret)
  ------------------
  |  Branch (956:7): [True: 0, False: 245]
  ------------------
  957|      0|    my_syslog(LOG_ERR, _("failed to allocate %d bytes"), (int) size);
  ------------------
  |  |   91|      0|#  define _(S) (S)
  ------------------
  958|    245|  else if (daemon->log_malloc)
  ------------------
  |  |  169|    245|#define daemon dnsmasq_daemon
  ------------------
  |  Branch (958:12): [True: 0, False: 245]
  ------------------
  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|    245|  return ret;
  962|    245|}
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.11k|{
  137|       |  /* remove trailing . 
  138|       |     also fail empty string and label > 63 chars */
  139|  1.11k|  size_t dotgap = 0, wiresize = 0, l = strlen(in);
  140|  1.11k|  char c;
  141|  1.11k|  int nowhite = 0;
  142|  1.11k|  int idn_encode = 0;
  143|  1.11k|  int hasuscore = 0;
  144|  1.11k|  int hasucase = 0;
  145|       |  
  146|  1.11k|  if (l == 0)
  ------------------
  |  Branch (146:7): [True: 103, False: 1.01k]
  ------------------
  147|    103|    return 0;
  148|       |  
  149|  1.01k|  if (in[l-1] == '.')
  ------------------
  |  Branch (149:7): [True: 35, False: 978]
  ------------------
  150|     35|    {
  151|     35|      in[l-1] = 0;
  152|     35|      nowhite = 1;
  153|     35|    }
  154|       |
  155|  18.3k|  for (; (c = *in); in++)
  ------------------
  |  Branch (155:10): [True: 17.7k, False: 657]
  ------------------
  156|  17.7k|    {
  157|  17.7k|      if (c == '.')
  ------------------
  |  Branch (157:11): [True: 2.74k, False: 14.9k]
  ------------------
  158|  2.74k|        {
  159|  2.74k|	  wiresize += dotgap + 1;
  160|  2.74k|	  dotgap = 0;
  161|  2.74k|	}
  162|  14.9k|      else if (++dotgap > MAXLABEL)
  ------------------
  |  |   54|  14.9k|#define MAXLABEL        63              /* maximum length of domain label */
  ------------------
  |  Branch (162:16): [True: 86, False: 14.8k]
  ------------------
  163|     86|        return 0;
  164|  14.8k|      else if (isascii((unsigned char)c) && iscntrl((unsigned char)c)) 
  ------------------
  |  Branch (164:16): [True: 14.6k, False: 198]
  |  Branch (164:45): [True: 72, False: 14.6k]
  ------------------
  165|       |        /* iscntrl only gives expected results for ascii */
  166|     72|        return 0;
  167|  14.8k|      else if (!isascii((unsigned char)c))
  ------------------
  |  Branch (167:16): [True: 198, False: 14.6k]
  ------------------
  168|    198|#if !defined(HAVE_IDN) && !defined(HAVE_LIBIDN2)
  169|    198|        return 0;
  170|       |#else
  171|       |        idn_encode = 1;
  172|       |#endif
  173|  14.6k|      else if (c != ' ')
  ------------------
  |  Branch (173:16): [True: 12.3k, False: 2.24k]
  ------------------
  174|  12.3k|        {
  175|  12.3k|          nowhite = 1;
  176|       |#if defined(HAVE_LIBIDN2) && (!defined(IDN2_VERSION_NUMBER) || IDN2_VERSION_NUMBER < 0x02000003)
  177|       |          if (c == '_')
  178|       |            hasuscore = 1;
  179|       |#else
  180|  12.3k|          (void)hasuscore;
  181|  12.3k|#endif
  182|       |
  183|       |#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
  184|       |          if (c >= 'A' && c <= 'Z')
  185|       |            hasucase = 1;
  186|       |#else
  187|  12.3k|          (void)hasucase;
  188|  12.3k|#endif
  189|  12.3k|        }
  190|  17.7k|    }
  191|       |
  192|    657|  if (!nowhite)
  ------------------
  |  Branch (192:7): [True: 68, False: 589]
  ------------------
  193|     68|    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|    589|  idn_encode = idn_encode || hasucase;
  ------------------
  |  Branch (200:16): [True: 0, False: 589]
  |  Branch (200:30): [True: 0, False: 589]
  ------------------
  201|    589|#endif
  202|       |
  203|       | /* length of final label and terminaton added */
  204|    589|  if (!idn_encode && wiresize + dotgap + 2 >  MAXDNAME)
  ------------------
  |  |   49|    589|#define MAXDNAME        255             /* Maximum size of a domain name in wire format */
  ------------------
  |  Branch (204:7): [True: 589, False: 0]
  |  Branch (204:22): [True: 7, False: 582]
  ------------------
  205|      7|    return 0; /* wire representation too long */
  206|       |
  207|    582|  return (idn_encode) ? 2 : 1;
  ------------------
  |  Branch (207:10): [True: 0, False: 582]
  ------------------
  208|    589|}

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

