if (strlen(list) + strlen(line) >= len - len2) {
if (strlen(list) + strlen(line) >= (size_t) (len - len2)) {
static int check_access(char *addr) {	int allowed = 0;	char *p, *list;	if (deny_all) {		rfbLog("check_access: new connections are currently "		    "blocked.\n");		return 0;	}	if (addr == NULL || *addr == '\0') {		rfbLog("check_access: denying empty host IP address string.\n");		return 0;	}	if (allow_list == NULL) {		/* set to "" to possibly append allow_once */		allow_list = strdup("");	}	if (*allow_list == '\0' && allow_once == NULL) {		/* no constraints, accept it */		return 1;	}	if (strchr(allow_list, '/')) {		/* a file of IP addresess or prefixes */		int len, len2 = 0;		struct stat sbuf;		FILE *in;		char line[1024], *q;		if (stat(allow_list, &sbuf) != 0) {			rfbLog("check_access: failure stating file: %s\n",			    allow_list);			rfbLogPerror("stat");			clean_up_exit(1);		}		len = sbuf.st_size + 1;	/* 1 more for '\0' at end */		if (allow_once) {			len2 = strlen(allow_once) + 2;			len += len2;		}		list = malloc(len);		list[0] = '\0';				in = fopen(allow_list, "r");		if (in == NULL) {			rfbLog("check_access: cannot open: %s\n", allow_list);			rfbLogPerror("fopen");			clean_up_exit(1);		}		while (fgets(line, 1024, in) != NULL) {			if ( (q = strchr(line, '#')) != NULL) {				*q = '\0';			}			if (strlen(list) + strlen(line) >= len - len2) {				/* file grew since our stat() */				break;			}			strcat(list, line);		}		fclose(in);		if (allow_once) {			strcat(list, "\n");			strcat(list, allow_once);			strcat(list, "\n");		}	} else {		int len = strlen(allow_list) + 1;		if (allow_once) {			len += strlen(allow_once) + 1;		}		list = malloc(len);		list[0] = '\0';		strcat(list, allow_list);		if (allow_once) {			strcat(list, ",");			strcat(list, allow_once);		}	}	if (allow_once) {		free(allow_once);		allow_once = NULL;	}		p = strtok(list, ", \t\n\r");	while (p) {		char *chk, *q, *r = NULL;		if (*p == '\0') {			p = strtok(NULL, ", \t\n\r");			continue;			}		if (! dotted_ip(p)) {			r = host2ip(p);			if (r == NULL || *r == '\0') {				rfbLog("check_access: bad lookup \"%s\"\n", p);				p = strtok(NULL, ", \t\n\r");				continue;			}			rfbLog("check_access: lookup %s -> %s\n", p, r);			chk = r;		} else {			chk = p;		}		q = strstr(addr, chk);		if (chk[strlen(chk)-1] != '.') {			if (!strcmp(addr, chk)) {				if (chk != p) {					rfbLog("check_access: client %s "					    "matches host %s=%s\n", addr,					    chk, p);				} else {					rfbLog("check_access: client %s "					    "matches host %s\n", addr, chk);				}				allowed = 1;			} else if(!strcmp(chk, "localhost") &&			    !strcmp(addr, "127.0.0.1")) {				allowed = 1;			}		} else if (q == addr) {			rfbLog("check_access: client %s matches pattern %s\n",			    addr, chk);			allowed = 1;		}		p = strtok(NULL, ", \t\n\r");		if (r) {			free(r);		}		if (allowed) {			break;		}	}	free(list);	return allowed;}