[358] in Moira

home help back first fref pref prev next nref lref last post

Some suspicious-looking code in .../moira/clients/moira/utils.c

daemon@ATHENA.MIT.EDU (Jim Haynes)
Mon Jan 20 22:17:40 1992

From: haynes@cats.UCSC.EDU (Jim Haynes)
Date: Mon, 20 Jan 92 19:17:01 -0800
To: bug-moira@Athena.MIT.EDU


int
GetValueFromUser(prompt, pointer)
char * prompt, ** pointer;
{
    char buf[BUFSIZ];

    if (PromptWithDefault(prompt, buf, BUFSIZ, *pointer) == 0)
	return(SUB_ERROR);

/* 
 * If these are the same then there is no need to allocate a new string.
 *
 * a difference that makes no difference, IS no difference.
 */

??>    if (strcmp(buf, *pointer) != 0) { 
??>	if (*pointer != NULL)
	    free(*pointer);
	*pointer = Strsave(buf);
    }
    return(SUB_NORMAL);
}


The second line marked with ??> above suggests that *pointer could be
NULL.  In which case the previous line has dereferenced a null pointer,
hasn't it??


home help back first fref pref prev next nref lref last post