summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Savchenko <bircoph@gentoo.org>2020-07-12 10:48:05 +0300
committerAndrew Savchenko <bircoph@gentoo.org>2020-07-12 11:20:47 +0300
commit5c1e46228c4d82bd7ce24d740b11622d31ec8291 (patch)
treeb8e1e32500d327f5e2e4a91605b920de94a35888 /net-proxy
parentnet-proxy/privoxy: simplify /var/run removal (diff)
downloadgentoo-5c1e46228c4d82bd7ce24d740b11622d31ec8291.tar.gz
gentoo-5c1e46228c4d82bd7ce24d740b11622d31ec8291.tar.bz2
gentoo-5c1e46228c4d82bd7ce24d740b11622d31ec8291.zip
net-proxy/privoxy: fix problems found by gcc
1. Check chdir return value for possible failure in jcc.c 2. Fix possible buffer overflow in gateway.c: strncpy does not always NULL-terminate string. Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Andrew Savchenko <bircoph@gentoo.org>
Diffstat (limited to 'net-proxy')
-rw-r--r--net-proxy/privoxy/files/privoxy-3.0.28-chdir.patch15
-rw-r--r--net-proxy/privoxy/files/privoxy-3.0.28-null-termination.patch13
-rw-r--r--net-proxy/privoxy/privoxy-3.0.28.ebuild2
3 files changed, 30 insertions, 0 deletions
diff --git a/net-proxy/privoxy/files/privoxy-3.0.28-chdir.patch b/net-proxy/privoxy/files/privoxy-3.0.28-chdir.patch
new file mode 100644
index 000000000000..66d14a9fc3c4
--- /dev/null
+++ b/net-proxy/privoxy/files/privoxy-3.0.28-chdir.patch
@@ -0,0 +1,15 @@
+diff '--color=auto' -Naurd privoxy-3.0.28-stable.orig/jcc.c privoxy-3.0.28-stable/jcc.c
+--- privoxy-3.0.28-stable.orig/jcc.c 2018-12-30 21:40:13.000000000 +0300
++++ privoxy-3.0.28-stable/jcc.c 2020-07-11 14:43:39.851143843 +0300
+@@ -4013,7 +4013,10 @@
+ }
+ #endif
+
+- chdir("/");
++ if (chdir("/"))
++ {
++ log_error(LOG_LEVEL_FATAL, "Cannot chdir /");
++ }
+
+ } /* -END- if (daemon_mode) */
+
diff --git a/net-proxy/privoxy/files/privoxy-3.0.28-null-termination.patch b/net-proxy/privoxy/files/privoxy-3.0.28-null-termination.patch
new file mode 100644
index 000000000000..295b739a05f6
--- /dev/null
+++ b/net-proxy/privoxy/files/privoxy-3.0.28-null-termination.patch
@@ -0,0 +1,13 @@
+diff '--color=auto' -Naurd privoxy-3.0.28-stable.orig/gateway.c privoxy-3.0.28-stable/gateway.c
+--- privoxy-3.0.28-stable.orig/gateway.c 2018-12-30 21:40:13.000000000 +0300
++++ privoxy-3.0.28-stable/gateway.c 2020-07-11 14:55:15.442676106 +0300
+@@ -1103,7 +1103,8 @@
+ cbuf[client_pos++] = (char)(hostlen & 0xffu);
+ assert(sizeof(cbuf) - client_pos > (size_t)255);
+ /* Using strncpy because we really want the nul byte padding. */
+- strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos);
++ strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos - 1);
++ cbuf[sizeof(cbuf)-1] = 0;
+ client_pos += (hostlen & 0xffu);
+ cbuf[client_pos++] = (char)((target_port >> 8) & 0xff);
+ cbuf[client_pos++] = (char)((target_port ) & 0xff);
diff --git a/net-proxy/privoxy/privoxy-3.0.28.ebuild b/net-proxy/privoxy/privoxy-3.0.28.ebuild
index efb5ce555c45..8c9734145461 100644
--- a/net-proxy/privoxy/privoxy-3.0.28.ebuild
+++ b/net-proxy/privoxy/privoxy-3.0.28.ebuild
@@ -43,6 +43,8 @@ S="${WORKDIR}/${P%_*}-${PRIVOXY_STATUS}"
PATCHES=(
"${FILESDIR}"/${PN}-3.0.19-gentoo.patch
+ "${FILESDIR}"/${P}-chdir.patch
+ "${FILESDIR}"/${P}-null-termination.patch
)
pkg_pretend() {