summaryrefslogtreecommitdiffstats
path: root/network/redir/patches/06_fix_shaper_buffer.dpatch
diff options
context:
space:
mode:
author Matteo Bernardini2014-08-22 17:43:47 +0200
committer Matteo Bernardini2014-08-22 17:43:47 +0200
commit88a27c19bfbd4bafef50ba2cb167b671fe409e53 (patch)
tree2d2972d399db1728c07c2c89c7efbe53a98c3079 /network/redir/patches/06_fix_shaper_buffer.dpatch
parentc1916c8b21c893da6e93245ec22af95574ab4c24 (diff)
downloadold.slackbuilds-88a27c19bfbd4bafef50ba2cb167b671fe409e53.tar.gz
20140822.1 global branch merge.current-20140822.1
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'network/redir/patches/06_fix_shaper_buffer.dpatch')
-rw-r--r--network/redir/patches/06_fix_shaper_buffer.dpatch63
1 files changed, 63 insertions, 0 deletions
diff --git a/network/redir/patches/06_fix_shaper_buffer.dpatch b/network/redir/patches/06_fix_shaper_buffer.dpatch
new file mode 100644
index 0000000000..47c1e132ea
--- /dev/null
+++ b/network/redir/patches/06_fix_shaper_buffer.dpatch
@@ -0,0 +1,63 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 06_fix_shaper_buffer.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: properly allocate copyloop buffer
+
+@DPATCH@
+diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
+--- redir-2.2.1~/redir.c 2005-10-22 23:20:05.235901424 -0400
++++ redir-2.2.1/redir.c 2005-10-22 23:22:20.198384008 -0400
+@@ -260,7 +260,7 @@
+ #endif
+ int *transproxy,
+ #ifndef NO_SHAPER
+- unsigned int * bufsize,
++ unsigned int * bufsizeout,
+ int * max_bandwidth,
+ int * random_wait,
+ int * wait_in_out,
+@@ -367,7 +367,7 @@
+
+ #ifndef NO_SHAPER
+ case 'z':
+- *bufsize = (unsigned int)atol(optarg);
++ *bufsizeout = (unsigned int)atol(optarg);
+ break;
+
+ case 'm':
+@@ -594,7 +594,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);
+@@ -637,7 +637,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)
+@@ -652,7 +652,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
+@@ -689,6 +689,7 @@
+ syslog(LOG_NOTICE, "disconnect %d secs, %ld in %ld out",
+ (end_time - start_time), bytes_in, bytes_out);
+ }
++ free(buf);
+ return;
+ }
+