Fix segfault in fopen, no check for null

This commit is contained in:
Hypsurus
2015-10-13 19:33:05 +03:00
parent a409d1cee6
commit bea2fc990d

View File

@@ -244,7 +244,11 @@ char *check_whitelist(char *ip_address)
void load_list(char *file_path, int type)
{
FILE *fp = fopen(file_path, "r");
FILE *fp;
if (( fp = fopen(file_path, "r")) == NULL )
error("cannot load list");
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);