Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uA6ny-00Angz-Ol for pgsql-committers@arkaria.postgresql.org; Wed, 30 Apr 2025 12:44:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uA6nv-00DsfL-KY for pgsql-committers@arkaria.postgresql.org; Wed, 30 Apr 2025 12:44:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uA6nv-00DsfC-DQ for pgsql-committers@lists.postgresql.org; Wed, 30 Apr 2025 12:44:48 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uA6nu-000MN9-1Q for pgsql-committers@lists.postgresql.org; Wed, 30 Apr 2025 12:44:48 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7E2E72540213; Wed, 30 Apr 2025 08:44:44 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 30 Apr 2025 08:44:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1746017084; x=1746103484; bh=omMHERzjDW/GkN5W7qp0IRiP9tZB4ITB QFln3NxPrO4=; b=aJFFCTaNeT36wPtT6KcZolWLV6Pu1uFyOhdxDCrcx9tt9QMl iDeZ18Legehk0ahZqLTmRj7zFd3W9f3gAB6Bzz7XK5R5f+Sry8xWm3xHvoejgdI9 O3U494fDNGzcvYqi+Mn1ksn4h2N/voJQBd9LFh7qvpjdj4nFS5KQJc6tSpnZgPos GFoUuOONLUCEWaitoseHwStLOeFoekYwQOO/xr15eSKs7exsvthAIR++3QdCC512 sjxu05YP6kTgRjMJxBGea9Ye1u7ORn+jtRdv96AtuFZPWDtUoEOH3p0uK78zfro0 l4ZoxdOX6aPyq6EAcfVSRX3m1yfMuCjBfCpz1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1746017084; x= 1746103484; bh=omMHERzjDW/GkN5W7qp0IRiP9tZB4ITBQFln3NxPrO4=; b=w Vw/taFSSPkSt1O2UOnnh/qS66NBKRlsq+fTPQ5CWhdZMGaZYvcxWD/4sBOj/L8hm q7AuOnah1hkevAGYQpeaxyY+gRlAb4O9Z02+xt7L9K6J0Vmh4fRgToUZIVr/qYIK yeZtHCsETKoeNPN48Lj0Bf9rGkuz4FFBN4+9DX2uvq+9ZP2z1EJI3PSboYNR6Xnw ayXtVEMShiUJRvFYMZuqQdScbULmb9BhqD8EmFaUdCdZE911kvE64oN9hH7W3Dhd B0lcQ2RUo6LFlsdOijrmup76wmHq5RLoOgYiFPnutzc+VTO9L+GXWmkG3URjY3Ny Pk1LQXbrfE+yF1jYt8bGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieeijeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddt vdejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvih hsvghnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepgfejtdfhkeeftdeugfei leehteeljeeghfeuledthfeutedvffdukeefjefhgeehnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhht rdhorhhgpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtth hopegughhrohiflhgvhihmlhesghhmrghilhdrtghomhdprhgtphhtthhopegurghnihgv lheshigvshhqlhdrshgvpdhrtghpthhtohepphhgshhqlhdqtghomhhmihhtthgvrhhsse hlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Apr 2025 08:44:43 -0400 (EDT) Message-ID: <0755ae22-4e04-4c69-b344-8c4db54d6e23@eisentraut.org> Date: Wed, 30 Apr 2025 14:44:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Add missing string terminator To: David Rowley , Daniel Gustafsson Cc: pgsql-committers@lists.postgresql.org References: <9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se> Content-Language: de-DE, en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 30.04.25 13:56, David Rowley wrote: > On Wed, 30 Apr 2025 at 23:43, David Rowley wrote: >> memcpy() would make more sense IMO, since the length is >> known already. I'm fine with either, however. > > In case you're looking for inspiration on a standard to follow, > commits such as 586dd5d6a did seem to favour memcpy() when the length > was known and only use strlcpy() when it wasn't. It looks like the memcpy() uses in that commit are for cases where we don't want/need the null terminator. I think it's best in general to use str* for strings and mem* for not-strings. That's easier to read and also better for static analyzers etc.