do not allow dns_servers_no to be set higher than the number of
authorMiklos Tirpak <miklos@iptel.org>
Wed, 13 Feb 2008 15:25:13 +0000 (15:25 +0000)
committerMiklos Tirpak <miklos@iptel.org>
Wed, 13 Feb 2008 15:25:13 +0000 (15:25 +0000)
DNS servers defined in /etc/resolv.conf

resolve.c

index c1d3f96..a28f97d 100644 (file)
--- a/resolve.c
+++ b/resolve.c
@@ -130,8 +130,9 @@ static int _resolv_init()
                _res.retrans=cfg_get(core, core_cfg, dns_retr_time);
        if (cfg_get(core, core_cfg, dns_retr_no)>0)
                _res.retry=cfg_get(core, core_cfg, dns_retr_no);
-       if (cfg_get(core, core_cfg, dns_servers_no)>=0)
-               _res.nscount=cfg_get(core, core_cfg, dns_servers_no);
+       if ((cfg_get(core, core_cfg, dns_servers_no)>=0)
+               && (cfg_get(core, core_cfg, dns_servers_no)<_res.nscount))
+                       _res.nscount=cfg_get(core, core_cfg, dns_servers_no);
        if (cfg_get(core, core_cfg, dns_search_list)==0)
                _res.options&=~(RES_DEFNAMES|RES_DNSRCH);
 #else