uninitialized-variable-20040605
authorJeffrey Altman <jaltman@mit.edu>
Sun, 6 Jun 2004 04:51:41 +0000 (04:51 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 6 Jun 2004 04:51:41 +0000 (04:51 +0000)
 cm_dns.c: getAFSServers() did not initialize the output
           parameters before testing them when setting the
           return value.  It therefore returned success
           when the network was unavailable. Bad Bad Bad.

src/WINNT/afsd/cm_dns.c

index 14fa426..81a3962 100644 (file)
@@ -698,14 +698,14 @@ int getAFSServer(char *cellName, int *cellHostAddrs, char cellHostNames[][MAXHOS
        DWORD i;
     struct sockaddr_in vlSockAddr;
 
+    *numServers = 0; 
+    *ttl = 0;
+
     /* query the AFSDB records of cell */
        if (DnsQuery_A(cellName, DNS_TYPE_AFSDB, DNS_QUERY_STANDARD, NULL, &pDnsCell, NULL) == ERROR_SUCCESS) {
 
                memset((void*) &vlSockAddr, 0, sizeof(vlSockAddr));
                
-               *numServers = 0; 
-        *ttl = 0;
-
                /* go through the returned records */
                for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
                        /* if we find an AFSDB record with Preference set to 1, we found a volserver */