summaryrefslogtreecommitdiff
path: root/src/nss-resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/nss-resolve')
-rw-r--r--src/nss-resolve/nss-resolve.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index 39b73203d2..6a029a331b 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -404,10 +404,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
alen = FAMILY_ADDRESS_SIZE(af);
l = strlen(canonical);
- ms = ALIGN(l+1) +
- sizeof(char*) +
- (c > 0 ? c : 1) * ALIGN(alen) +
- (c > 0 ? c+1 : 2) * sizeof(char*);
+ ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
if (buflen < ms) {
*errnop = ENOMEM;