From: Remi Gacogne Date: Fri, 23 Mar 2018 09:43:21 +0000 (+0100) Subject: Remove a VLA in waitForMultiData() X-Git-Tag: dnsdist-1.3.0~31^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dcc0e65d8355b74052ab6fe4d8e9bc249810e63e;p=thirdparty%2Fpdns.git Remove a VLA in waitForMultiData() --- diff --git a/pdns/misc.cc b/pdns/misc.cc index b4c6d5cf8b..11d31f4e85 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -362,8 +362,8 @@ int waitForMultiData(const set& fds, const int seconds, const int useconds, } } - struct pollfd pfds[realFDs.size()]; - memset(&pfds[0], 0, realFDs.size()*sizeof(struct pollfd)); + std::vector pfds(realFDs.size()); + memset(&pfds.at(0), 0, realFDs.size()*sizeof(struct pollfd)); int ctr = 0; for (const auto& fd : realFDs) { pfds[ctr].fd = fd; @@ -373,9 +373,9 @@ int waitForMultiData(const set& fds, const int seconds, const int useconds, int ret; if(seconds >= 0) - ret = poll(pfds, realFDs.size(), seconds * 1000 + useconds/1000); + ret = poll(&pfds.at(0), realFDs.size(), seconds * 1000 + useconds/1000); else - ret = poll(pfds, realFDs.size(), -1); + ret = poll(&pfds.at(0), realFDs.size(), -1); if(ret <= 0) return ret;