From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hamster.birch.relay.mailchannels.net (hamster.birch.relay.mailchannels.net [23.83.209.80]) by sourceware.org (Postfix) with ESMTPS id 7FF923858D33 for ; Tue, 6 Jun 2023 12:42:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FF923858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.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 A7F2840A20; Tue, 6 Jun 2023 12:42:49 +0000 (UTC) Received: from pdx1-sub0-mail-a232.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 27C574145F; Tue, 6 Jun 2023 12:42:49 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1686055369; a=rsa-sha256; cv=none; b=1KAA5Zkd5NExkRierC2Ddy89zcNvRe3eXDnyvDNwuKsSZ4A85483ugcJGlcmgoPsN5LGvy PigskdSFDfGWQH5Y2analGN+oAzwAnIvYFYaTvn3cZzOxNypiyg008yk7eAD5+FzseDBYt Oc9OF+5crUebKOjfxIEnmDQpgc1cuiAq3CuFYPrQR94hR5BnxtWM7cgIWsRSLThGuQUI0L ZLei9r3LfqnqCDB509EOAmEkwgigoKV9lE57kyhH392lP/JcwWEoBcPAUROSUn5xwsH3OS aanjJtMZ5/iO+qMBhztSizxfhNhKGA38cyXTf8D6WvXJzh3VcEIAJ79IOrqwFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1686055369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=c2pklmzjgria4nnf5sMl/p6uzY/9GwvKZ6S6FiJ97LI=; b=8WtVgWhelQQZJcqs4hHVjO7Mwb84C17L59Be+De7GdkC4m8VoZFT5Tg6JstNawMeBInJyP EeYXWbpHnd2fTHRT4miyvHipUdXW2jQc4NgenBq//7upGf75ZR6youbb9TJDNUC21xm0wo 6j12cuJSS3ib5scXc86vx54456au8niWQhwIx0BaL0FqnCRGGYSAQ93IvCujkliSslSy4c vnULDVh3buTPH4sl70UY5ivDMA4Npd8ZRBgo4mimI9lbF8lknFJPE2NBRDKLFzbwwJryrb Pxv8gKADUVf6Wwqu7TnPDhmAhRIIwH3Sy1jEYYPzwHmKbE2J8MaRkMDY7kXwYQ== ARC-Authentication-Results: i=1; rspamd-5f966895c-mdtfb; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Tasty-Illegal: 4f8f9b5e09efaf46_1686055369450_2484514158 X-MC-Loop-Signature: 1686055369450:2860144645 X-MC-Ingress-Time: 1686055369450 Received: from pdx1-sub0-mail-a232.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.115.252.249 (trex/6.8.1); Tue, 06 Jun 2023 12:42:49 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-02-142-113-138-85.dsl.bell.ca [142.113.138.85]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a232.dreamhost.com (Postfix) with ESMTPSA id 4Qb99h5B6rzY5; Tue, 6 Jun 2023 05:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1686055368; bh=c2pklmzjgria4nnf5sMl/p6uzY/9GwvKZ6S6FiJ97LI=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=ARUrnCytCarMGEmuajM0nsayZoXkMi91bachfd+LxEHbSL3BVkGcics8VobPES5sZ D2ftWh7NnfTVyyOZQz5mVvb5wcwPUt0sjmj+fZO3df9Wwyz3z6udwqa/rllh89urP5 CxEGM3xV6n6Q9pIJ3ugCURoVx48DFS6Sb5nkQEZkUNefzOKiwRIVB+gnQHAFbyhW94 bzvA5fnH6Yvi1m2m/U//i1Cd321+Muy4EG+Cqsc8B3TC2Y9xO4nJzQknWszTkV3Jsh x9MxAd2W1Imkbg5en9tyYFXB8sKvM8JA6htiqcX8DPo6fxsrxMZCoOVELGDxGDdDKT Bh+iuzJHUXm7Q== Message-ID: <4e29f176-ea9e-d913-2d36-f310ca5cab6e@gotplt.org> Date: Tue, 6 Jun 2023 08:42:47 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 3/3] manual: Manual update for strlcat, strlcpy, wcslcat, wclscpy Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org References: <7bfe308b-d558-9094-9d42-b62784fc4669@gotplt.org> <877csg93ni.fsf@oldenburg3.str.redhat.com> From: Siddhesh Poyarekar In-Reply-To: <877csg93ni.fsf@oldenburg3.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 2023-06-06 08:27, Florian Weimer wrote: > * Siddhesh Poyarekar: > >>> +The behavior is undefined if @var{to} or @var{from} is a null pointer, >>> +or if the destination array's size is less than @var{size}, or if the >>> +string @var{from} overlaps the first @var{size} bytes of the >>> +destination array. >> >> Shouldn't this be undefined for all kinds of overlaps between @var{to} >> and @var{from} and not just when the @{from} overlaps with the first >> @var{size} bytes of @var{to}? > > I don't think so. There is no reason why the data couldn't be copied > within the same array. This can plausibly happen if a custom memory > allocator is used, for example. Uhmm, I haven't heard of the customer allocator argument being used in this context but I suppose it makes sense. I'm probably just getting jitters about specifying behaviour to that much detail when a simple "behavior is undefined if FROM and TO overlap" would suffice. I mean this argument could be made for memcpy or any function that assumes non-aliased inputs. >> Also, perhaps s/destination array/@var{to}/ to make it clearer. > > I don't think so because it's confusing whether the size refers to TO > itself or (conceptually) to *TO. Fair enough. Reviewed-by: Siddhesh Poyarekar