From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id E71AB3858402; Sun, 23 Jan 2022 00:36:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E71AB3858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aquilenet.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aquilenet.fr Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E6D973E4; Sun, 23 Jan 2022 01:36:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SOZ6o-sXSCYb; Sun, 23 Jan 2022 01:36:03 +0100 (CET) Received: from begin (unknown [IPv6:2a01:cb19:956:1b00:de41:a9ff:fe47:ec49]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B420D16D; Sun, 23 Jan 2022 01:36:02 +0100 (CET) Received: from samy by begin with local (Exim 4.95) (envelope-from ) id 1nBQrQ-002ksU-RJ; Sun, 23 Jan 2022 01:36:00 +0100 Date: Sun, 23 Jan 2022 01:36:00 +0100 From: Samuel Thibault To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org, joseph@codesourcery.com Subject: Re: [PATCH] tst-realpath-toolong: Fix hurd build Message-ID: <20220123003600.a42uwp67446vlcep@begin> References: <20220122144523.2221584-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220122144523.2221584-1-siddhesh@sourceware.org> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: E6D973E4 X-Spamd-Result: default: False [0.40 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; MID_RHS_NOT_FQDN(0.50)[] X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2022 00:36:10 -0000 Siddhesh Poyarekar via Libc-alpha, le sam. 22 janv. 2022 20:15:23 +0530, a ecrit: > We don't really need a bigger buffer for realpath since it should fail > and return NULL. In the bug too, the buffer itself is not accessed; it > is in fact left untouched. Drop the PATH_MAX use and pass a single char > address. ? realpath assumes that the passed buffer is PATH_MAX-long. When PATH_MAX is not defined, calling it with a buffer is essentially undefined. Better just pass NULL. > Signed-off-by: Siddhesh Poyarekar > --- > stdlib/tst-realpath-toolong.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c > index 8bed772460..ed84787a32 100644 > --- a/stdlib/tst-realpath-toolong.c > +++ b/stdlib/tst-realpath-toolong.c > @@ -34,8 +34,8 @@ do_test (void) > { > char *base = support_create_and_chdir_toolong_temp_directory (BASENAME); > > - char buf[PATH_MAX + 1]; > - const char *res = realpath (".", buf); > + char buf; > + const char *res = realpath (".", &buf); > > /* canonicalize.c states that if the real path is >= PATH_MAX, then > realpath returns NULL and sets ENAMETOOLONG. */ > -- > 2.34.1 >