From 4438f9defcd18bc1ded87f69d9ab8f6441218ec4 Mon Sep 17 00:00:00 2001 From: наб Date: Mon, 11 Nov 2024 15:43:56 +0100 Subject: Replace constant-size never-reallicated getservbyport_r() std::vector buffer with std::array --- apt-pkg/contrib/srvrec.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc index 4a68f3578..3ddb95abb 100644 --- a/apt-pkg/contrib/srvrec.cc +++ b/apt-pkg/contrib/srvrec.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -47,7 +48,7 @@ bool GetSrvRecords(std::string host, int port, std::vector &Result) int res; struct servent s_ent_buf; struct servent *s_ent = nullptr; - std::vector buf(1024); + std::array buf; res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent); if (res != 0 || s_ent == nullptr) -- cgit v1.2.3-70-g09d2