diff -Nur a/redir.c b/redir.c --- a/redir.c 2005-10-22 23:20:05.235901424 -0400 +++ b/redir.c 2005-10-22 23:22:20.198384008 -0400 @@ -259,7 +259,7 @@ #endif int *transproxy, #ifndef NO_SHAPER - unsigned int * bufsize, + unsigned int * bufsizeout, int * max_bandwidth, int * random_wait, int * wait_in_out, @@ -366,7 +366,7 @@ #ifndef NO_SHAPER case 'z': - *bufsize = (unsigned int)atol(optarg); + *bufsizeout = (unsigned int)atol(optarg); break; case 'm': @@ -593,7 +593,7 @@ unsigned long bytes_in = 0; unsigned long bytes_out = 0; unsigned int start_time, end_time; - char buf[bufsize]; + char* buf = malloc(bufsize); /* Record start time */ start_time = (unsigned int) time(NULL); @@ -632,7 +632,7 @@ } if(FD_ISSET(insock, &c_iofds)) { - if((bytes = read(insock, buf, sizeof(buf))) <= 0) + if((bytes = read(insock, buf, bufsize)) <= 0) break; #ifndef NO_FTP if (ftp & FTP_PORT) @@ -647,7 +647,7 @@ bytes_out += bytes; } if(FD_ISSET(outsock, &c_iofds)) { - if((bytes = read(outsock, buf, sizeof(buf))) <= 0) + if((bytes = read(outsock, buf, bufsize)) <= 0) break; /* if we're correcting for PASV on ftp redirections, then fix buf and bytes to have the new address, among other @@ -684,6 +684,7 @@ syslog(LOG_NOTICE, "disconnect %d secs, %ld in %ld out", (end_time - start_time), bytes_in, bytes_out); } + free(buf); return; }