From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by sourceware.org (Postfix) with ESMTPS id 007533857C44 for ; Tue, 11 Aug 2020 18:29:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 007533857C44 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=fw@deneb.enyo.de Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1k5Z1m-0000pT-53; Tue, 11 Aug 2020 18:29:38 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1k5Z1m-0002Vf-0Z; Tue, 11 Aug 2020 20:29:38 +0200 From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Subject: Re: [PATCH 2/3] stdlib: Enforce PATH_MAX on allocated realpath buffer References: <20200810204856.2111211-1-adhemerval.zanella@linaro.org> <20200810204856.2111211-2-adhemerval.zanella@linaro.org> <877du537w8.fsf@mid.deneb.enyo.de> <87bljhqzgx.fsf@igel.home> <87h7t91nw2.fsf@mid.deneb.enyo.de> Date: Tue, 11 Aug 2020 20:29:38 +0200 In-Reply-To: (Adhemerval Zanella via Libc-alpha's message of "Tue, 11 Aug 2020 12:05:03 -0300") Message-ID: <878selyr1p.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 11 Aug 2020 18:29:41 -0000 * Adhemerval Zanella via Libc-alpha: > On 11/08/2020 07:24, Florian Weimer wrote: >> * Andreas Schwab: >> >>> On Aug 11 2020, Florian Weimer wrote: >>> >>>> I don't think Linux has such a restriction. One cannot open such >>>> files directly, but they can exist. >>> >>> You can open them with a relative name as long as cwd is nearer than >>> PATH_MAX (or use openat with such a directory handle). >> >> Yes, that's what I meant: one cannot use the full path directly. It >> has to be split up in some way. >> >> I still think realpath should report the full path for them, and not >> give up with an error. Similar for getcwd. >> > > The only issue I have with this approach is realpath has different semantic > regarding maximum pathname returned whether you pass a 'resolved' buffer > (which assume PATH_MAX). This is just our attempt to avoid the inherent buffer overflows in this interface. We had to do something similar for readdir_r.