This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix modification of string literal by swprintf


On Jun  8 13:15, Thomas Preudhomme wrote:
> Please find his updated patch attached.
> 
> Best regards,
> 
> Thomas

> >From ee96a273969b0bccd308b81bcdf37a6fdefa06f6 Mon Sep 17 00:00:00 2001
> From: Silviu Baranga <silviu.baranga@arm.cm>
> Date: Mon, 5 Jun 2017 09:54:42 +0100
> Subject: [PATCH] Don't overread or write memory returned by _DTOA_R
> 
> Don't over-read memory returned by _DTOA_R, and never write to it
> since the result might be a string literal.
> 
> For example, when doing:
>   swprintf(tt, 20, L"%.*f", 6, 0.0);
> 
> we will get back "0".
> 
> 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

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]