From: Jeffrey Altman Date: Thu, 1 Jul 2004 09:00:40 +0000 (+0000) Subject: dns-fix-20040630 X-Git-Tag: openafs-devel-1_3_66~70 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=cccb91291f77ce0c6be0ed4659b43c848938e022;p=packages%2Fo%2Fopenafs.git dns-fix-20040630 Fix the dns portion of cm_GetCell() to prevent against a NULL pointer dereference when the ttl expired. --- diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 8107329da..682be66d9 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -85,8 +85,8 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) ) { int dns_expired = 0; if (!cp) { - cp = malloc(sizeof(*cp)); - memset(cp, 0, sizeof(*cp)); + cp = malloc(sizeof(cm_cell_t)); + memset(cp, 0, sizeof(cm_cell_t)); } else { dns_expired = 1; @@ -109,6 +109,7 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) if (dns_expired) { cp->flags |= CM_CELLFLAG_VLSERVER_INVALID; cp = NULL; /* set cp to NULL to indicate error */ + goto done; } } else { /* got cell from DNS */ @@ -126,7 +127,7 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) } /* randomise among those vlservers having the same rank*/ - cm_RandomizeServer(&cp->vlServersp); + cm_RandomizeServer(&cp->vlServersp); #ifdef AFS_AFSDB_ENV if (dns_expired) {