strncpy(password,curpass,CRYPTED_MD5PWD_LEN+1);
strncpy(password,curpass,CRYPTED_BCPWD_LEN+1);
static int fgetpwnam(FILE *stream, const char *name, char *password) {    char tempLine[256], *tpointer, *curname, *curpass, *fgr;    int loopdone, pwdfound;    int len;        /* go to beginning of file */    rewind(stream);    /* some control variables */    loopdone = pwdfound = 0;    /* fgets should do this, but we make sure */    tempLine[255] = '\0';    /* iterate through lines in file, until end of file */    do {	/* get the current line */	fgr = fgets(tempLine,255,stream);	/* if it's valid, go on */	if ( fgr != NULL) {	    /* first get the username out */	    tpointer = tempLine;	    curname = strsep(&tpointer,":");	    /* check to see if it's the right one */	    if (strcmp(curname,name)==0) {		/* at least we know our loop is done */		loopdone = 1;		/* remove possible trailing newline */		len = strlen(tpointer);		if (tpointer[len - 1] == '\n')		    tpointer[len - 1] = '\0';		/* get the password and put it in its place */		curpass = strsep(&tpointer,":");		if (curpass != NULL) {		    /* we use md5 pwd len, as this is just a safe maximum */		    strncpy(password,curpass,CRYPTED_MD5PWD_LEN+1);		    pwdfound = 1;		} /* if (curpass... */	    } /* if (strcmp(curname... */	} /* if (tempLine... */    } while (fgr != NULL);    return pwdfound;}