getaddrinfo() does not detect invalid numeric services (bug 16208)
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
redhat-pt-bot/TryBot-32bit |
fail
|
Patch series failed to apply
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
Hi!
I have found relatively simple fix at bug 16208. I got that and applied
that to recent glibc. Fixed constants a bit.
Quite self contained functionality and safe to merge, IMO.
From 99bfa52cdbc0d90236b922436220c5e586d46e6a Mon Sep 17 00:00:00 2001
From: Shawn Landden <shawn@churchofgit.com>
Date: Sat, 23 Nov 2013 08:19:58 -0800
Subject: [PATCH] getaddrinfo: return EAI_SERVICE when TCP or UDP port out of
range (bug 16208)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Changed to use constant and fixed typo. Allow also service=0, especially
useful for AI_PASSIVE.
Reported-by: Martin Pool <mbp@sourcefrog.net>
Signed-off-by: Shawn Landden <shawn@churchofgit.com>
Signed-off-by: Petr Menšík <pemensik@redhat.com>
---
nss/getaddrinfo.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -2377,6 +2377,12 @@ getaddrinfo (const char *name, const char *service,
gaih_service.num = -1;
}
+ else if ((hints->ai_family == AF_INET || hints->ai_family == AF_INET6)
+ && (hints->ai_socktype == SOCK_STREAM || hints->ai_socktype == SOCK_DGRAM)
+ && gaih_service.num > UINT16_MAX)
+ {
+ return EAI_SERVICE;
+ }
pservice = &gaih_service;
}
--
2.47.0