--- knock-0.5.orig/src/knockd.c +++ knock-0.5/src/knockd.c @@ -131,9 +131,9 @@ int o_daemon = 0; int o_lookup = 0; char o_int[32] = ""; /* default (eth0) is set after parseconfig() */ -char o_cfg[PATH_MAX] = "/etc/knockd.conf"; -char o_pidfile[PATH_MAX] = "/var/run/knockd.pid"; -char o_logfile[PATH_MAX] = ""; +char o_cfg[4096] = "/etc/knockd.conf"; +char o_pidfile[4096] = "/var/run/knockd.pid"; +char o_logfile[4096] = ""; int main(int argc, char **argv) { @@ -435,7 +435,7 @@ int parseconfig(char *configfile) { FILE *fp = NULL; - char line[PATH_MAX+1]; + char line[4096+1]; char *ptr = NULL; char *key = NULL; int linenum = 0; @@ -448,7 +448,7 @@ return(1); } - while(fgets(line, PATH_MAX, fp)) { + while(fgets(line, 4096, fp)) { linenum++; trim(line); if(strlen(line) == 0 || line[0] == '#') { @@ -509,12 +509,12 @@ trim(ptr); if(!strcmp(section, "options")) { if(!strcmp(key, "LOGFILE")) { - strncpy(o_logfile, ptr, PATH_MAX-1); - o_logfile[PATH_MAX-1] = '\0'; + strncpy(o_logfile, ptr, 4096-1); + o_logfile[4096-1] = '\0'; dprint("config: log file: %s\n", o_logfile); } else if(!strcmp(key, "PIDFILE")) { - strncpy(o_pidfile, ptr, PATH_MAX-1); - o_pidfile[PATH_MAX-1] = '\0'; + strncpy(o_pidfile, ptr, 4096-1); + o_pidfile[4096-1] = '\0'; dprint("config: pid file: %s\n", o_pidfile); } else if(!strcmp(key, "INTERFACE")) { /* set interface only if it has not already been set by the -i switch */ @@ -692,11 +692,11 @@ */ long get_next_one_time_sequence(opendoor_t *door) { - char line[PATH_MAX+1]; + char line[4096+1]; int pos; pos = ftell(door->one_time_sequences_fd); - while(fgets(line, PATH_MAX, door->one_time_sequences_fd)) { + while(fgets(line, 4096, door->one_time_sequences_fd)) { trim(line); if(strlen(line) == 0 || line[0] == '#') { pos = ftell(door->one_time_sequences_fd); @@ -1382,8 +1382,8 @@ /* run the associated command */ if(fork() == 0) { /* child */ - char parsed_start_cmd[PATH_MAX]; - char parsed_stop_cmd[PATH_MAX]; + char parsed_start_cmd[4096]; + char parsed_stop_cmd[4096]; size_t cmd_len = 0; setsid();