Forcibly zero-out data structures after allocting them.
authoraland <aland>
Wed, 31 Jul 2002 17:17:29 +0000 (17:17 +0000)
committeraland <aland>
Wed, 31 Jul 2002 17:17:29 +0000 (17:17 +0000)
src/main/client.c
src/main/nas.c

index 9a65834..8ac87a8 100644 (file)
@@ -166,6 +166,7 @@ int read_clients_file(const char *file)
                 *      It should be OK now, let's create the buffer.
                 */
                c = rad_malloc(sizeof(RADCLIENT));
+               memset(c, 0, sizeof(*c));
 
                c->ipaddr = ip_getaddr(hostnm);
                if (c->ipaddr == INADDR_NONE) {
index b822f18..0fab99a 100644 (file)
@@ -87,7 +87,7 @@ int read_naslist_file(char *file)
 
                p = buffer;
                if (!getword(&p, hostnm, sizeof(hostnm)) ||
-                               !getword(&p, shortnm, sizeof(shortnm))) {
+                   !getword(&p, shortnm, sizeof(shortnm))) {
                        radlog(L_ERR, "%s[%d]: unexpected end of line", file, lineno);
                        continue;
                }
@@ -119,6 +119,7 @@ int read_naslist_file(char *file)
                 *      It should be OK now, let's create the buffer.
                 */
                nas = rad_malloc(sizeof(NAS));
+               memset(nas, 0, sizeof(*nas));
 
                strcpy(nas->nastype, nastype);
                strcpy(nas->shortname, shortnm);