Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230227203308.192122-1-izbyshev@ispras.ru>
Date: Mon, 27 Feb 2023 23:33:08 +0300
From: Alexey Izbyshev <izbyshev@...ras.ru>
To: musl@...ts.openwall.com
Subject: [PATCH] getservbyport_r: fix wrong result if getnameinfo fails with EAI_OVERFLOW

EAI_OVERFLOW should be propagated as ERANGE to inform the caller about
the need to expand the buffer.
---
 src/network/getservbyport_r.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c
index b7f21c6b..f8d1e854 100644
--- a/src/network/getservbyport_r.c
+++ b/src/network/getservbyport_r.c
@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,
 	case EAI_MEMORY:
 	case EAI_SYSTEM:
 		return ENOMEM;
+	case EAI_OVERFLOW:
+		return ERANGE;
 	default:
 		return ENOENT;
 	case 0:
-- 
2.39.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.