From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85149 invoked by alias); 9 Jun 2017 13:32:37 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 85131 invoked by uid 89); 9 Jun 2017 13:32:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=his, H*c:application X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Jun 2017 13:32:34 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC0F9C057FA4 for ; Fri, 9 Jun 2017 13:32:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC0F9C057FA4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vinschen@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EC0F9C057FA4 Received: from calimero.vinschen.de (ovpn-117-161.ams2.redhat.com [10.36.117.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43CB8187A1 for ; Fri, 9 Jun 2017 13:32:37 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 85146A805C9; Fri, 9 Jun 2017 15:32:36 +0200 (CEST) Date: Fri, 09 Jun 2017 13:32:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: Fix modification of string literal by swprintf Message-ID: <20170609133236.GA26770@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <608ad190-c35e-76b1-99d3-e96dd64d85e2@foss.arm.com> <20170607100157.GB18287@calimero.vinschen.de> <50149eef-d512-4bb0-3d5e-fcd6302b8083@foss.arm.com> <4dd496b3-b19c-8618-a701-5f1d15f1a602@foss.arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <4dd496b3-b19c-8618-a701-5f1d15f1a602@foss.arm.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017/txt/msg00400.txt.bz2 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 890 On Jun 8 13:15, Thomas Preudhomme wrote: > Please find his updated patch attached. >=20 > Best regards, >=20 > Thomas > >From ee96a273969b0bccd308b81bcdf37a6fdefa06f6 Mon Sep 17 00:00:00 2001 > From: Silviu Baranga > Date: Mon, 5 Jun 2017 09:54:42 +0100 > Subject: [PATCH] Don't overread or write memory returned by _DTOA_R >=20 > Don't over-read memory returned by _DTOA_R, and never write to it > since the result might be a string literal. >=20 > For example, when doing: > swprintf(tt, 20, L"%.*f", 6, 0.0); >=20 > we will get back "0". >=20 > Instead, write the result returned by _DTOA_R to the output buffer. > After this, write the 0 chars directly to the the output buffer > (if there are any). This also has the (marginal) advantage that > we read/write less memory overall. Pushed. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZOqN0AAoJEPU2Bp2uRE+gl3UP/2b7yS1drJQGTId82ZUv7ozA LYQDz/t2dM+scKgzwOwh1SAwH4voGTH+XgXc8loL8jHyl2XRGLZd3RFyC0GSPzsH SQkl32BAVlD8nhGOLfwFVill/MpI+dpmIOiq2Mvv/hh280iW5cPaoQ35o5YF0bBn ocIMhK19KHSG99Xqa9VaHPL7ixURVu8GPJakILNXv2aW0XtBsVp9oQKscIu6wdKI nznovYV4EzH0PBJ5S/NNYb04ZYSEy7ucSkFHl+bCicPm0o/+h/4O2k9qGM3k6I7Y lPsozY0COwgYRqm20//SrrWBf/MLsKWdW+NfHjglcsjVCsHoMQLs7R8piBDG2uZf yfJBGspz8scK8Skkeoq86047eaR1hjqXqv4vBjTrS3f3JkZVYj0Dbv92+xqLMbJN l39VsD0JkprEKGgKebGCK57nLZS1hZLTCOjPVOgB6xdvA9aTpEmF9CCtHcbTLA7R a2LBHzbUbn3lg/YWez+/9zbNcIo47Shdmfqw3YhLgcnJ1Ew/Byx2cMYrBPEKnbtF lYGmQNlzC4aatA54RFV30tHzTCNdwsf9+7NfdKeUvFV/r8Vhjxluzi38/csrXlYJ kkBoqHsjNq3tPCkecv2SqPwNvgfPtJM75nf7Zs1EeL/vyyJ6jWo4cKw44qszSL/Q Jvjx6+gTmpNlTA6vkaPs =EzKP -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--