If a single s6-ftrigrd is requested to listen on many listeners, the genalloc_readyplus may have to move the ftrigio's to a new memory area, causing the char* inside their buffer to get outdated, overwriting unrelated memory areas when filling the buffers and possibly triggering a SIGSEGV.
With this patch, it always updates the buffer's char* before filling it. Signed-off-by: Carlos Eduardo <carana2...@gmail.com> --- src/libs6/s6-ftrigrd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c index b6ca40b..e3366cc 100644 --- a/src/libs6/s6-ftrigrd.c +++ b/src/libs6/s6-ftrigrd.c @@ -90,13 +90,13 @@ static void remove (size_t i) ftrigio *a = genalloc_s(ftrigio, &g) ; ftrigio_deepfree(a + i) ; a[i] = a[--n] ; - a[i].b.c.x = a[i].buf ; genalloc_setlen(ftrigio, &g, n) ; } static inline int ftrigio_read (ftrigio *p) { unsigned int i = FTRIGRD_MAXREADS ; + p->b.c.x = p->buf ; while (i--) { regmatch_t pmatch ; -- 2.44.0