From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19213 invoked from network); 12 Oct 2021 11:04:57 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 12 Oct 2021 11:04:57 -0000 Received: (qmail 23608 invoked by uid 550); 12 Oct 2021 11:03:13 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 22375 invoked from network); 12 Oct 2021 03:24:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=eteau4a26zmxk2ijau6sgb3me4huyrhc; d=openwall.com.au; t=1634009048; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; bh=O2C1m20izp/Xl4myywWtqDRtwXIrMzfnbuZhz/YvlFA=; b=OwO7/wrnbq0mmd/hKJHxUIpwDROlRmDFroOf0vqXcZZa9MhX66e5L3kBZeHDZLoT outaEmyUgx607z72clQWVMpvBn5jDbznFD3i65rsZkge2Xg0z4gPd02/UC2PpEuNW6Y KN6LJLMv44InRWB9sw6CVeJ73c6LUS2XHBpn/ykk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1634009048; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To:Feedback-ID; bh=O2C1m20izp/Xl4myywWtqDRtwXIrMzfnbuZhz/YvlFA=; b=eBXjhWKhH4eeoNCniy53pcds8a07vHfZ8VrDYHB16dKjWYGroDfbEO0A09SfyFVU j9SV7nXKi2gNzHILM6JZMsM1TWk2udxKod+ITx0ZQPJagzsZG/Luf9018VESrDb6jsY hupqXLOKhipfZLSG1V3PTxeqIuxWr3VYn3EV9Ris= ARC-Seal:i=1; a=rsa-sha256; d=openwall.com.au; s=20180402; t=1634009047; cv=none; b=t+TZNSCNsY5xOZ6eMg4xgp6oPo+mdu77CV3tN+d8+Ona9zmEiXfL/uhIzQvCnz+Wg7KvJBgU5T0wYW33sfMgVbBXMU0yf8Ks6iRmcV5jWWyUMQ59ZB6EZlGD9W5TUYZig2ClJBWiO5XSwxhtwaG+bI6OO2HwECex5fXcUMKv3p1kEgeS/E44JiSEy9PR8i2q6SbUz+ZGMpfe5SksvnpFdMd1NS/ly/yBy6kSjeYDjf/pjBtWqKeMmnMVyX+9aTRs+NA9KrN5ia1WC+IumIvJYDajx1ULQFs/a+NIWBihp9B/esNGj7ha+nDh8Kvy8Q3PMR1JybPExLZEQHuViXKYYw== ARC-Message-Signature:i=1; a=rsa-sha256; d=openwall.com.au; s=20180402; t=1634009047; c=relaxed/simple; bh=O2C1m20izp/Xl4myywWtqDRtwXIrMzfnbuZhz/YvlFA=; h=From:To:Cc:Subject; b=Z0UBf/f3JIlMLnCZhAds9NM7MI13NIOTsDOBIDiuPD2K2yJeV3o6j9LW7QXSGRwe4TDnK+cM4Jz6rwuM+VEqWwiWCkR/AjAioUrJITXCH2wV4R8jOj5aQy9v699wYKgVMEgIvPpdhRgPf3BeIOUk/jfx2WnAcXbVWiY0/b2j0Plpvd0xqjfBra4LDPVYn1k5pgzAFzmGudQBhfVdoEEJkAKzmauyzOt4CLsDgDRnJN8lKOmPwNTWTgt3sYvoeLHTddpiYxO/wbOkc3r8DsD0zf8nmtaoUoBM5P61cMDjtRe93AjpKIHo6kE7rF8KaO8WBWJnDrTTdiN+R04WGFTYBg== ARC-Authentication-Results:i=1; mail.openwall.com.au; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=openwall.com.au; s=20180402; t=1634009047; bh=O2C1m20izp/Xl4myywWtqDRtwXIrMzfnbuZhz/YvlFA=; h=From:To:Cc:Subject:From; b=gQf7ToRSOhGH2hpgah3jpwrnmUsc+H8jUjgERiMvMd45/dP3DrC5pjyQ64K1E/IWQ TiHgJ90B0DmHj9jCBBbq3rV8QhI9MW09d+w/WyEqN5nFPD/q+B4yS1sznTviwQufkk 33tQRBRPMPkevQBz6A8yFhj/GkpojLqyNx4zV92YBGx5w5HYmGDndPje8J+vdmUg8Y IXHAuqM54Xzid5tCo2bKtcDMunhscfwjmFe2TVockIGpg5j5y6SV8vfc5LcPXPlE9/ BjqfiYNNvy/XEKJHFuwf9wipPwoJMQnepnMGvQnctpjeP12UQpmJGsqSknPBTvkj5b oVUqWS0W38XeA== Date: Tue, 12 Oct 2021 03:24:07 +0000 From: "(GalaxyMaster)" To: musl@lists.openwall.com Cc: 2010267516@qq.com, Kaihang Zhang Message-ID: <0100017c7287622f-cceed952-52dc-4c02-b1af-b3943a41203c-000000@email.amazonses.com> References: <20211012023643.44509-1-kaihang.zhang@smartx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211012023643.44509-1-kaihang.zhang@smartx.com> User-Agent: Mutt/1.5.21 (2010-09-15) Feedback-ID: 1.us-east-1.Br0WpcLm0XzNPYp+t39aA5qSwb/HYCx3zC5wkQY3G2s=:AmazonSES X-SES-Outgoing: 2021.10.12-54.240.48.37 Subject: Re: [musl] [PATCH] fix: Assign default value to mntent when linebuf is too small Kaihang, On Mon, Oct 11, 2021 at 10:36:43PM -0400, Kaihang Zhang wrote: > Function getmntent_r in source misc/mntent.c will do what glibc users > expect. The rest of the line will be discarded when can not be read > into linebuf, and the fields of struct mntent will be assigned to empty > string or zero when can not be found in linebuf, instead of setting > errno to ERANGE and exiting. Although this patch is on a similar topic as mine (changing the behaviour of get*ent() funnctions), I think the change you are describing is considerable. I would expect a function such as getmntent_r() which takes a user provided buffer to fail and set ERANGE if the provided buffer is not enough to hold the line. This gives the developer an opportunity to recover, e.g. to re-allocate a bigger buffer and try again. In your proposal, I see two issues: 1. There is no feedback to the developer, so they have no idea whether the information they've got from the function was truncated or not (and what good does a truncated mnt line bring?); 2. There is no opportunity for the developer to realise a mistake they made by supplying too small buffer, hence there is no chance of recovering from it. It is just my opinion and I would love to see other comments, since I have not stumbled upon your use case yet and am not authoritative on this topic. -- (GM)