mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix config parser memory leaks.
git-svn-id: file:///svn/unbound/trunk@5014 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
42244e1b4d
commit
4c7f824e0a
3 changed files with 388 additions and 335 deletions
|
|
@ -1,3 +1,6 @@
|
|||
10 December 2018: Wouter
|
||||
- Fix config parser memory leaks.
|
||||
|
||||
6 December 2018: Wouter
|
||||
- Fix dns64 allocation in wrong region for returned internal queries.
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1469,6 +1469,8 @@ server_access_control: VAR_ACCESS_CONTROL STRING_ARG STRING_ARG
|
|||
yyerror("expected deny, refuse, deny_non_local, "
|
||||
"refuse_non_local, allow, allow_setrd or "
|
||||
"allow_snoop in access control action");
|
||||
free($2);
|
||||
free($3);
|
||||
} else {
|
||||
if(!cfg_str2list_insert(&cfg_parser->cfg->acls, $2, $3))
|
||||
fatal_exit("out of memory adding acl");
|
||||
|
|
@ -1747,13 +1749,15 @@ server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
|
|||
&& strcmp($3, "always_refuse")!=0
|
||||
&& strcmp($3, "always_nxdomain")!=0
|
||||
&& strcmp($3, "noview")!=0
|
||||
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0)
|
||||
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0) {
|
||||
yyerror("local-zone type: expected static, deny, "
|
||||
"refuse, redirect, transparent, "
|
||||
"typetransparent, inform, inform_deny, "
|
||||
"always_transparent, always_refuse, "
|
||||
"always_nxdomain, noview or nodefault");
|
||||
else if(strcmp($3, "nodefault")==0) {
|
||||
free($2);
|
||||
free($3);
|
||||
} else if(strcmp($3, "nodefault")==0) {
|
||||
if(!cfg_strlist_insert(&cfg_parser->cfg->
|
||||
local_zones_nodefault, $2))
|
||||
fatal_exit("out of memory adding local-zone");
|
||||
|
|
@ -1866,8 +1870,10 @@ server_local_zone_tag: VAR_LOCAL_ZONE_TAG STRING_ARG STRING_ARG
|
|||
&len);
|
||||
free($3);
|
||||
OUTYY(("P(server_local_zone_tag:%s)\n", $2));
|
||||
if(!bitlist)
|
||||
if(!bitlist) {
|
||||
yyerror("could not parse tags, (define-tag them first)");
|
||||
free($2);
|
||||
}
|
||||
if(bitlist) {
|
||||
if(!cfg_strbytelist_insert(
|
||||
&cfg_parser->cfg->local_zone_tags,
|
||||
|
|
@ -1885,8 +1891,10 @@ server_access_control_tag: VAR_ACCESS_CONTROL_TAG STRING_ARG STRING_ARG
|
|||
&len);
|
||||
free($3);
|
||||
OUTYY(("P(server_access_control_tag:%s)\n", $2));
|
||||
if(!bitlist)
|
||||
if(!bitlist) {
|
||||
yyerror("could not parse tags, (define-tag them first)");
|
||||
free($2);
|
||||
}
|
||||
if(bitlist) {
|
||||
if(!cfg_strbytelist_insert(
|
||||
&cfg_parser->cfg->acl_tags,
|
||||
|
|
@ -1939,8 +1947,6 @@ server_access_control_view: VAR_ACCESS_CONTROL_VIEW STRING_ARG STRING_ARG
|
|||
if(!cfg_str2list_insert(&cfg_parser->cfg->acl_view,
|
||||
$2, $3)) {
|
||||
yyerror("out of memory");
|
||||
free($2);
|
||||
free($3);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -1951,8 +1957,10 @@ server_response_ip_tag: VAR_RESPONSE_IP_TAG STRING_ARG STRING_ARG
|
|||
&len);
|
||||
free($3);
|
||||
OUTYY(("P(response_ip_tag:%s)\n", $2));
|
||||
if(!bitlist)
|
||||
if(!bitlist) {
|
||||
yyerror("could not parse tags, (define-tag them first)");
|
||||
free($2);
|
||||
}
|
||||
if(bitlist) {
|
||||
if(!cfg_strbytelist_insert(
|
||||
&cfg_parser->cfg->respip_tags,
|
||||
|
|
@ -2029,6 +2037,8 @@ server_ratelimit_for_domain: VAR_RATELIMIT_FOR_DOMAIN STRING_ARG STRING_ARG
|
|||
OUTYY(("P(server_ratelimit_for_domain:%s %s)\n", $2, $3));
|
||||
if(atoi($3) == 0 && strcmp($3, "0") != 0) {
|
||||
yyerror("number expected");
|
||||
free($2);
|
||||
free($3);
|
||||
} else {
|
||||
if(!cfg_str2list_insert(&cfg_parser->cfg->
|
||||
ratelimit_for_domain, $2, $3))
|
||||
|
|
@ -2042,6 +2052,8 @@ server_ratelimit_below_domain: VAR_RATELIMIT_BELOW_DOMAIN STRING_ARG STRING_ARG
|
|||
OUTYY(("P(server_ratelimit_below_domain:%s %s)\n", $2, $3));
|
||||
if(atoi($3) == 0 && strcmp($3, "0") != 0) {
|
||||
yyerror("number expected");
|
||||
free($2);
|
||||
free($3);
|
||||
} else {
|
||||
if(!cfg_str2list_insert(&cfg_parser->cfg->
|
||||
ratelimit_below_domain, $2, $3))
|
||||
|
|
@ -2119,10 +2131,10 @@ server_ipsecmod_enabled: VAR_IPSECMOD_ENABLED STRING_ARG
|
|||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->ipsecmod_enabled = (strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
#endif
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
server_ipsecmod_ignore_bogus: VAR_IPSECMOD_IGNORE_BOGUS STRING_ARG
|
||||
|
|
@ -2132,10 +2144,10 @@ server_ipsecmod_ignore_bogus: VAR_IPSECMOD_IGNORE_BOGUS STRING_ARG
|
|||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->ipsecmod_ignore_bogus = (strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
#endif
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
server_ipsecmod_hook: VAR_IPSECMOD_HOOK STRING_ARG
|
||||
|
|
@ -2146,6 +2158,7 @@ server_ipsecmod_hook: VAR_IPSECMOD_HOOK STRING_ARG
|
|||
cfg_parser->cfg->ipsecmod_hook = $2;
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
free($2);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
@ -2159,6 +2172,7 @@ server_ipsecmod_max_ttl: VAR_IPSECMOD_MAX_TTL STRING_ARG
|
|||
free($2);
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
free($2);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
@ -2170,6 +2184,7 @@ server_ipsecmod_whitelist: VAR_IPSECMOD_WHITELIST STRING_ARG
|
|||
yyerror("out of memory");
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
free($2);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
@ -2183,6 +2198,7 @@ server_ipsecmod_strict: VAR_IPSECMOD_STRICT STRING_ARG
|
|||
free($2);
|
||||
#else
|
||||
OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
|
||||
free($2);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
@ -2390,13 +2406,15 @@ view_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
|
|||
&& strcmp($3, "always_refuse")!=0
|
||||
&& strcmp($3, "always_nxdomain")!=0
|
||||
&& strcmp($3, "noview")!=0
|
||||
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0)
|
||||
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0) {
|
||||
yyerror("local-zone type: expected static, deny, "
|
||||
"refuse, redirect, transparent, "
|
||||
"typetransparent, inform, inform_deny, "
|
||||
"always_transparent, always_refuse, "
|
||||
"always_nxdomain, noview or nodefault");
|
||||
else if(strcmp($3, "nodefault")==0) {
|
||||
free($2);
|
||||
free($3);
|
||||
} else if(strcmp($3, "nodefault")==0) {
|
||||
if(!cfg_strlist_insert(&cfg_parser->cfg->views->
|
||||
local_zones_nodefault, $2))
|
||||
fatal_exit("out of memory adding local-zone");
|
||||
|
|
@ -2432,7 +2450,6 @@ view_local_data: VAR_LOCAL_DATA STRING_ARG
|
|||
OUTYY(("P(view_local_data:%s)\n", $2));
|
||||
if(!cfg_strlist_insert(&cfg_parser->cfg->views->local_data, $2)) {
|
||||
fatal_exit("out of memory adding local-data");
|
||||
free($2);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -2555,6 +2572,7 @@ dt_dnstap_enable: VAR_DNSTAP_ENABLE STRING_ARG
|
|||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap = (strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_socket_path: VAR_DNSTAP_SOCKET_PATH STRING_ARG
|
||||
|
|
@ -2570,6 +2588,7 @@ dt_dnstap_send_identity: VAR_DNSTAP_SEND_IDENTITY STRING_ARG
|
|||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_send_identity = (strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_send_version: VAR_DNSTAP_SEND_VERSION STRING_ARG
|
||||
|
|
@ -2578,6 +2597,7 @@ dt_dnstap_send_version: VAR_DNSTAP_SEND_VERSION STRING_ARG
|
|||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_send_version = (strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_identity: VAR_DNSTAP_IDENTITY STRING_ARG
|
||||
|
|
@ -2601,6 +2621,7 @@ dt_dnstap_log_resolver_query_messages: VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES ST
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_resolver_query_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_log_resolver_response_messages: VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES STRING_ARG
|
||||
|
|
@ -2610,6 +2631,7 @@ dt_dnstap_log_resolver_response_messages: VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSA
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_resolver_response_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_log_client_query_messages: VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES STRING_ARG
|
||||
|
|
@ -2619,6 +2641,7 @@ dt_dnstap_log_client_query_messages: VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES STRING
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_client_query_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_log_client_response_messages: VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES STRING_ARG
|
||||
|
|
@ -2628,6 +2651,7 @@ dt_dnstap_log_client_response_messages: VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_client_response_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_log_forwarder_query_messages: VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES STRING_ARG
|
||||
|
|
@ -2637,6 +2661,7 @@ dt_dnstap_log_forwarder_query_messages: VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_forwarder_query_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
dt_dnstap_log_forwarder_response_messages: VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES STRING_ARG
|
||||
|
|
@ -2646,6 +2671,7 @@ dt_dnstap_log_forwarder_response_messages: VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MES
|
|||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->dnstap_log_forwarder_response_messages =
|
||||
(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
pythonstart: VAR_PYTHON
|
||||
|
|
@ -2700,7 +2726,6 @@ server_response_ip_data: VAR_RESPONSE_IP_DATA STRING_ARG STRING_ARG
|
|||
dnscstart: VAR_DNSCRYPT
|
||||
{
|
||||
OUTYY(("\nP(dnscrypt:)\n"));
|
||||
OUTYY(("\nP(dnscrypt:)\n"));
|
||||
}
|
||||
;
|
||||
contents_dnsc: contents_dnsc content_dnsc
|
||||
|
|
@ -2727,7 +2752,6 @@ dnsc_dnscrypt_enable: VAR_DNSCRYPT_ENABLE STRING_ARG
|
|||
dnsc_dnscrypt_port: VAR_DNSCRYPT_PORT STRING_ARG
|
||||
{
|
||||
OUTYY(("P(dnsc_dnscrypt_port:%s)\n", $2));
|
||||
|
||||
if(atoi($2) == 0)
|
||||
yyerror("port number expected");
|
||||
else cfg_parser->cfg->dnscrypt_port = atoi($2);
|
||||
|
|
@ -2829,6 +2853,7 @@ cachedb_backend_name: VAR_CACHEDB_BACKEND STRING_ARG
|
|||
cfg_parser->cfg->cachedb_backend = $2;
|
||||
#else
|
||||
OUTYY(("P(Compiled without cachedb, ignoring)\n"));
|
||||
free($2);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
|
|||
Loading…
Reference in a new issue