From 70a5ea407c71cf094794d3d3375aab7fc2c4eca6 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 27 Jun 2019 08:49:02 +0900 Subject: estream: Don't use variable length array. * src/estream.c [HAVE_POLL_H] (_gpgrt_poll): No VLA. -- Fixes-commit: a21a7de8c2cf986235382e7e04805744f6df116e Signed-off-by: NIIBE Yutaka --- src/estream.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/estream.c b/src/estream.c index 668eb1b..33b9f4d 100644 --- a/src/estream.c +++ b/src/estream.c @@ -4787,7 +4787,7 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) int idx; #ifndef HAVE_W32_SYSTEM # ifdef HAVE_POLL_H - struct pollfd poll_fds[nfds]; + struct pollfd *poll_fds = NULL; nfds_t poll_nfds; # else fd_set readfds, writefds, exceptfds; @@ -4851,6 +4851,7 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) #else /*!HAVE_W32_SYSTEM*/ # ifdef HAVE_POLL_H + poll_fds = xtrymalloc (sizeof (*poll_fds)*nfds); poll_nfds = 0; for (item = fds, idx = 0; idx < nfds; item++, idx++) { @@ -5039,6 +5040,11 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) #endif /*!HAVE_W32_SYSTEM*/ leave: +#ifndef HAVE_W32_SYSTEM +# ifdef HAVE_POLL_H + xfree (poll_fds); +# endif +#endif #ifdef ENABLE_TRACING trace (("leave: count=%d", count)); if (count > 0) -- cgit v1.2.3