VirtualBox

Changeset 29855 in vbox for trunk/src


Ignore:
Timestamp:
May 28, 2010 9:49:58 AM (15 years ago)
Author:
vboxsync
Message:

NAT: nits and a range fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r29755 r29855  
    420420    char buff2[256];
    421421    RTFILE f;
    422     int fFoundNameserver = 0;
     422    int cNameserversFound = 0;
    423423    int fWarnTooManyDnsServers = 0;
    424424    struct in_addr tmp_addr;
     
    469469
    470470    Log(("NAT: DNS Servers:\n"));
    471     while (    RT_SUCCESS(rc = RTFileGets(f, buff, 512, &bytes))
     471    while (    RT_SUCCESS(rc = RTFileGets(f, buff, sizeof(buff), &bytes))
    472472            && rc != VERR_EOF)
    473473    {
    474474        struct dns_entry *pDns = NULL;
    475         if (   fFoundNameserver == 4
     475        if (   cNameserversFound == 4
    476476            && fWarnTooManyDnsServers == 0
    477             && sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1)
     477            && sscanf(buff, "nameserver%*[ \t]%255s", buff2) == 1)
    478478        {
    479479            fWarnTooManyDnsServers = 1;
    480480            LogRel(("NAT: too many nameservers registered.\n"));
    481481        }
    482         if (   sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1
    483             && fFoundNameserver < 4) /* Unix doesn't accept more than 4 name servers*/
     482        if (   sscanf(buff, "nameserver%*[ \t]%255s", buff2) == 1
     483            && cNameserversFound < 4) /* Unix doesn't accept more than 4 name servers*/
    484484        {
    485485            if (!inet_aton(buff2, &tmp_addr))
     
    501501            }
    502502            TAILQ_INSERT_HEAD(&pData->pDnsList, pDns, de_list);
    503             fFoundNameserver++;
     503            cNameserversFound++;
    504504        }
    505505        if ((!strncmp(buff, "domain", 6) || !strncmp(buff, "search", 6)))
     
    534534    }
    535535    RTFileClose(f);
    536     if (!fFoundNameserver)
     536    if (!cNameserversFound)
    537537        return -1;
    538538    return 0;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette