1 |
commit: 2ce3a8e57adc2ea9389c35301ce081ab89b42931 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 9 15:16:40 2019 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 9 15:17:03 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ce3a8e5 |
7 |
|
8 |
net-misc/dhcpcd: Revbump to fix incorrect string termination |
9 |
|
10 |
Bug: https://bugs.gentoo.org/691426 |
11 |
Package-Manager: Portage-2.3.71, Repoman-2.3.17 |
12 |
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> |
13 |
|
14 |
...{dhcpcd-8.0.2.ebuild => dhcpcd-8.0.2-r1.ebuild} | 4 ++ |
15 |
.../files/dhcpcd-8.0.2-string_termination.patch | 80 ++++++++++++++++++++++ |
16 |
2 files changed, 84 insertions(+) |
17 |
|
18 |
diff --git a/net-misc/dhcpcd/dhcpcd-8.0.2.ebuild b/net-misc/dhcpcd/dhcpcd-8.0.2-r1.ebuild |
19 |
similarity index 98% |
20 |
rename from net-misc/dhcpcd/dhcpcd-8.0.2.ebuild |
21 |
rename to net-misc/dhcpcd/dhcpcd-8.0.2-r1.ebuild |
22 |
index d8940210a7b..1696c38dcf7 100644 |
23 |
--- a/net-misc/dhcpcd/dhcpcd-8.0.2.ebuild |
24 |
+++ b/net-misc/dhcpcd/dhcpcd-8.0.2-r1.ebuild |
25 |
@@ -27,6 +27,10 @@ COMMON_DEPEND="udev? ( virtual/udev )" |
26 |
DEPEND="${COMMON_DEPEND}" |
27 |
RDEPEND="${COMMON_DEPEND}" |
28 |
|
29 |
+PATCHES=( |
30 |
+ "${FILESDIR}"/${P}-string_termination.patch #691426 |
31 |
+) |
32 |
+ |
33 |
src_configure() { |
34 |
local myeconfargs=( |
35 |
--dbdir="${EPREFIX}/var/lib/dhcpcd" |
36 |
|
37 |
diff --git a/net-misc/dhcpcd/files/dhcpcd-8.0.2-string_termination.patch b/net-misc/dhcpcd/files/dhcpcd-8.0.2-string_termination.patch |
38 |
new file mode 100644 |
39 |
index 00000000000..a1bc19ec974 |
40 |
--- /dev/null |
41 |
+++ b/net-misc/dhcpcd/files/dhcpcd-8.0.2-string_termination.patch |
42 |
@@ -0,0 +1,80 @@ |
43 |
+https://bugs.gentoo.org/691426 |
44 |
+ |
45 |
+diff --git a/src/dhcp-common.c b/src/dhcp-common.c |
46 |
+index 08ab9493..9f556557 100644 |
47 |
+--- a/src/dhcp-common.c |
48 |
++++ b/src/dhcp-common.c |
49 |
+@@ -645,14 +645,16 @@ print_option(FILE *fp, const char *prefix, const struct dhcp_opt *opt, |
50 |
+ if (fputc('=', fp) == EOF) |
51 |
+ return -1; |
52 |
+ if (dl == 0) |
53 |
+- return 1; |
54 |
++ goto out; |
55 |
+ |
56 |
+ if (opt->type & OT_RFC1035) { |
57 |
+ char domain[NS_MAXDNAME]; |
58 |
+ |
59 |
+ sl = decode_rfc1035(domain, sizeof(domain), data, dl); |
60 |
+- if (sl == 0 || sl == -1) |
61 |
+- return sl; |
62 |
++ if (sl == -1) |
63 |
++ return -1; |
64 |
++ if (sl == 0) |
65 |
++ goto out; |
66 |
+ if (valid_domainname(domain, opt->type) == -1) |
67 |
+ return -1; |
68 |
+ return efprintf(fp, "%s", domain); |
69 |
+@@ -693,9 +695,7 @@ print_option(FILE *fp, const char *prefix, const struct dhcp_opt *opt, |
70 |
+ return -1; |
71 |
+ } |
72 |
+ } |
73 |
+- if (fputc('\0', fp) == EOF) |
74 |
+- return -1; |
75 |
+- return 1; |
76 |
++ goto out; |
77 |
+ } |
78 |
+ |
79 |
+ t = data; |
80 |
+@@ -760,6 +760,7 @@ print_option(FILE *fp, const char *prefix, const struct dhcp_opt *opt, |
81 |
+ } |
82 |
+ } |
83 |
+ |
84 |
++out: |
85 |
+ if (fputc('\0', fp) == EOF) |
86 |
+ return -1; |
87 |
+ return 1; |
88 |
+diff --git a/src/script.c b/src/script.c |
89 |
+index 74aef1b1..3dee7b08 100644 |
90 |
+--- a/src/script.c |
91 |
++++ b/src/script.c |
92 |
+@@ -33,6 +33,7 @@ |
93 |
+ #include <netinet/in.h> |
94 |
+ #include <arpa/inet.h> |
95 |
+ |
96 |
++#include <assert.h> |
97 |
+ #include <ctype.h> |
98 |
+ #include <errno.h> |
99 |
+ #include <signal.h> |
100 |
+@@ -477,12 +478,21 @@ dumplease: |
101 |
+ fp = NULL; |
102 |
+ #endif |
103 |
+ |
104 |
++ /* Count the terminated env strings. |
105 |
++ * assert that the terminations are correct. */ |
106 |
+ nenv = 0; |
107 |
+ endp = buf + buf_pos; |
108 |
+ for (bufp = buf; bufp < endp; bufp++) { |
109 |
+- if (*bufp == '\0') |
110 |
++ if (*bufp == '\0') { |
111 |
++#ifndef NDEBUG |
112 |
++ if (bufp + 1 < endp) |
113 |
++ assert(*(bufp + 1) != '\0'); |
114 |
++#endif |
115 |
+ nenv++; |
116 |
++ } |
117 |
+ } |
118 |
++ assert(*--bufp == '\0'); |
119 |
++ |
120 |
+ if (ctx->script_envlen < nenv) { |
121 |
+ env = reallocarray(ctx->script_env, nenv + 1, sizeof(*env)); |
122 |
+ if (env == NULL) |