From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from brown.cedar.relay.mailchannels.net (brown.cedar.relay.mailchannels.net [23.83.210.23]) by sourceware.org (Postfix) with ESMTPS id 1A8783857730 for ; Sat, 16 Sep 2023 00:49:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A8783857730 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=sourceware.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3029AC1918; Sat, 16 Sep 2023 00:49:16 +0000 (UTC) Received: from pdx1-sub0-mail-a258.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C81D0C18DD; Sat, 16 Sep 2023 00:49:15 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1694825355; a=rsa-sha256; cv=none; b=UvU2AE4vfBB1FI1jQFRcDq6wAn+Wbhva2gMHvDJdinxJOgsRRcam0w+nfehUaik2NObDjW dMldXZI1n9/06Vb9oA8mpZ1M+TSTxkeSlPHeTuFX7t8H3bYQUK92Qjdqn4o27Bc0nV+PbP v4dGtXD1bF3ZNCXakEfNwxzIYFGCZ96KZh4nxJip9uQua5i0i8OGhq5RnYfMgvgPq7qfop lJ6Rto19zVb3IJAoTy+K0VBsK2NYaSaX/VMgTB7HOuwvQffM16EjXzetlsmCUP2P/C6FiP L4rFhzAUiw1PlPCfClv8od43UhKa6rT/drMwL9KRtqBVt/puMEw/QX4CaJYGYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1694825355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+CGlPJYDPX/isiQlnpUozsUxiRGqJ1U2JQ6uYhhq9fA=; b=QfcEwqERXozu1nO+pv7aFxZQInPwxVSifue1ZtuuAuxNPKiufSNNB/6h4akTBq0wMv5QK/ kG7r1XiKpTM2hYFulI8ASABQfrIvc1A0+ECdXavAL5fAPWIZTqSP1dujWvVTTZjhkO4tng BnsWu1JsjXgIsTMw4KutjJ2tzzspTiRNRg/SigcTcc27tf8b0bVkqv//U4cajIQE0kbznE h3wIu9i5Ef2dlnkpna/tzj1k9aNiwEufmD6KPXkvA+pH6DNl9HhlByk7EAGcV+rTI9UQr0 ENs+x41be3z8I0BopZ/R9TGTFdHXPA1L5n2Uw3PbpYLaZTUr9HZVfA5/8PUzaw== ARC-Authentication-Results: i=1; rspamd-7c449d4847-v4csc; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Good X-MC-Copy: stored-urls X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Cure-Abiding: 6fe893e9471c0305_1694825356037_1596473549 X-MC-Loop-Signature: 1694825356037:1524022723 X-MC-Ingress-Time: 1694825356036 Received: from pdx1-sub0-mail-a258.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.125.77.17 (trex/6.9.1); Sat, 16 Sep 2023 00:49:16 +0000 Received: from fedora.redhat.com (bras-vprn-toroon4834w-lp130-02-142-113-138-41.dsl.bell.ca [142.113.138.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a258.dreamhost.com (Postfix) with ESMTPSA id 4RnXWH2xVjzLB; Fri, 15 Sep 2023 17:49:15 -0700 (PDT) From: Siddhesh Poyarekar To: libc-stable@sourceware.org Cc: DJ Delorie Subject: [pushed 2.34 13/14] gethosts: Return EAI_MEMORY on allocation failure Date: Fri, 15 Sep 2023 20:49:00 -0400 Message-ID: <20230916004902.1151607-14-siddhesh@sourceware.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230916004902.1151607-1-siddhesh@sourceware.org> References: <20230916004902.1151607-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1172.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: All other cases of failures due to lack of memory return EAI_MEMORY, so it seems wrong to return EAI_SYSTEM here. The only reason convert_hostent_to_gaih_addrtuple could fail is on calloc failure. Signed-off-by: Siddhesh Poyarekar Reviewed-by: DJ Delorie (cherry picked from commit b587456c0e7b59dcfdbd2d44db000a3bc8244e57) --- sysdeps/posix/getaddrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 1008f24736..37260d6e6f 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -303,13 +303,13 @@ gethosts (nss_gethostbyname3_r fct, int family, const char *name, else if (status == NSS_STATUS_SUCCESS) { if (!convert_hostent_to_gaih_addrtuple (req, family, &th, res)) - return -EAI_SYSTEM; + return -EAI_MEMORY; if (localcanon != NULL && res->canon == NULL) { char *canonbuf = __strdup (localcanon); if (canonbuf == NULL) - return -EAI_SYSTEM; + return -EAI_MEMORY; res->canon = canonbuf; } } -- 2.41.0