From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id 394CC3858C50 for ; Sat, 18 Mar 2023 15:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 394CC3858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4Pf42L3NR6z1r2s5; Sat, 18 Mar 2023 16:01:14 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4Pf42L1gpRz1qqlW; Sat, 18 Mar 2023 16:01:14 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id SPJUG1JbQBdB; Sat, 18 Mar 2023 16:01:13 +0100 (CET) X-Auth-Info: /nIrhNB/xZx5tWIKam2TbZtgLGDCjZYc6WQGuaA3Z4jSeM3F1N6GsV1BQLzYxmgL Received: from igel.home (aftr-82-135-86-168.dynamic.mnet-online.de [82.135.86.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 18 Mar 2023 16:01:13 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 5EF9F2C1C5F; Sat, 18 Mar 2023 16:01:07 +0100 (CET) From: Andreas Schwab To: Vincent Lefevre Cc: Alejandro Colomar , libc-alpha@sourceware.org, Stephan Bergmann , Paul Eggert , Simon Chopin Subject: Re: UB status of snprintf on invalid ptr+size combination? References: <20230315123949.GC73312@zira.vinc17.org> <92810b6e-e7e6-6ffd-d33a-067b9f300059@redhat.com> <20230318020725.GA15308@zira.vinc17.org> <9c8cae93-cb8c-8689-1f0e-2b87514d3702@gmail.com> <20230318105827.GB15308@zira.vinc17.org> X-Yow: .. someone in DAYTON, Ohio is selling USED CARPETS to a SERBO-CROATIAN Date: Sat, 18 Mar 2023 16:01:07 +0100 In-Reply-To: <20230318105827.GB15308@zira.vinc17.org> (Vincent Lefevre's message of "Sat, 18 Mar 2023 11:58:27 +0100") Message-ID: <875yayyuh8.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 Mär 18 2023, Vincent Lefevre wrote: > However, I'm wondering whether such a change is intentional. BTW, > this description is even wrong: this is certainly not equivalent! > If the untruncated output is larger than n, then the call is UB > with sprintf(), while the output is truncated with snprintf(). Which makes them equivalent in all situations where sprintf is defined, so there is no discrepancy here. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."