aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-08-15 12:11:50 -0700
committerDave Barach <vpp@barachs.net>2023-08-15 20:58:35 +0000
commit55c699e098bd0cf2876ddd89862b8d930f8349aa (patch)
treeaefffdf97337dff540c8c1e98f51cd7d2d9c16df
parent5e9ed0dc81eaf98ad27b8a45948f5751ec873f20 (diff)
vcl: fix ldp epoll events array overrun
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3dd65946c220f958a4fda0551b053d690bf06c39
-rw-r--r--src/vcl/ldp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index cc281b0cae8..79e7cf3ee32 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -2681,6 +2681,7 @@ ldp_epoll_pwait_eventfd (int epfd, struct epoll_event *events,
timeout = 0;
if (rv >= maxevents)
goto done;
+ maxevents -= rv;
}
else if (PREDICT_FALSE (rv < 0))
{
@@ -2693,7 +2694,7 @@ epoll_again:
libc_evts = &events[rv];
libc_num_ev =
- libc_epoll_pwait (libc_epfd, libc_evts, maxevents - rv, timeout, sigmask);
+ libc_epoll_pwait (libc_epfd, libc_evts, maxevents, timeout, sigmask);
if (libc_num_ev <= 0)
{
rv = rv >= 0 ? rv : -1;