aboutsummaryrefslogtreecommitdiffstats
path: root/main/varnish/musl-fix-stack-overflow.patch
blob: aa83336ad4bb782abb3073c3a924f276675a04a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index 9e2e2a3..3b0105a 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -38,6 +38,7 @@
 #include <sys/epoll.h>
 
 #include <errno.h>
+#include <stdlib.h>
 
 #include "cache/cache_varnishd.h"
 
@@ -69,7 +70,7 @@ struct vwe {
 static void *
 vwe_thread(void *priv)
 {
-	struct epoll_event ev[NEEV], *ep;
+	struct epoll_event *ev, *ep;
 	struct waited *wp;
 	struct waiter *w;
 	double now, then;
@@ -82,6 +83,8 @@ vwe_thread(void *priv)
 	CHECK_OBJ_NOTNULL(w, WAITER_MAGIC);
 	THR_SetName("cache-epoll");
 	THR_Init();
+	ev = malloc(sizeof(struct epoll_event) * NEEV);
+	AN(ev);
 
 	now = VTIM_real();
 	while (1) {
@@ -146,6 +149,7 @@ vwe_thread(void *priv)
 		if (vwe->nwaited == 0 && vwe->die)
 			break;
 	}
+	free(ev);
 	closefd(&vwe->pipe[0]);
 	closefd(&vwe->pipe[1]);
 	closefd(&vwe->epfd);