Re: sprintf warning on overlapping output

2016-09-27 Thread Martin Sebor
On 09/25/2016 03:46 AM, Bernd Edlinger wrote: Hi Martin, in the past I have seen (and fixed) code like sprintf(buf, "%s %d", buf, x); that may possibly work by chance, but usually produces undefined results. Do you see a way to enhance the warning for cases where the output buffer overlaps an

Re: sprintf warning on overlapping output

2016-09-26 Thread Jakub Jelinek
On Mon, Sep 26, 2016 at 09:34:15AM -0600, Jeff Law wrote: > On 09/26/2016 09:20 AM, Florian Weimer wrote: > >* Jeff Law: > > > >>On 09/25/2016 03:46 AM, Bernd Edlinger wrote: > >>>Hi Martin, > >>> > >>>in the past I have seen (and fixed) code like > >>> > >>>sprintf(buf, "%s %d", buf, x); > >>> > >

Re: sprintf warning on overlapping output

2016-09-26 Thread Florian Weimer
* Jeff Law: sprintf(buf, "%s %d", buf, x); >> Or we could make this well-defined because it is such a useful >> extension. > That just encourages developers to write non-portable code. I'd > rather see this kind of thing halt the program in its tracks before > wandering into the realm of u

Re: sprintf warning on overlapping output

2016-09-26 Thread Jeff Law
On 09/26/2016 09:20 AM, Florian Weimer wrote: * Jeff Law: On 09/25/2016 03:46 AM, Bernd Edlinger wrote: Hi Martin, in the past I have seen (and fixed) code like sprintf(buf, "%s %d", buf, x); that may possibly work by chance, but usually produces undefined results. Do you see a way to enha

Re: sprintf warning on overlapping output

2016-09-26 Thread Florian Weimer
* Jeff Law: > On 09/25/2016 03:46 AM, Bernd Edlinger wrote: >> Hi Martin, >> >> in the past I have seen (and fixed) code like >> >> sprintf(buf, "%s %d", buf, x); >> >> that may possibly work by chance, but usually >> produces undefined results. >> >> Do you see a way to enhance the warning for ca

Re: sprintf warning on overlapping output

2016-09-26 Thread Jeff Law
On 09/25/2016 03:46 AM, Bernd Edlinger wrote: Hi Martin, in the past I have seen (and fixed) code like sprintf(buf, "%s %d", buf, x); that may possibly work by chance, but usually produces undefined results. Do you see a way to enhance the warning for cases where the output buffer overlaps an

Re: sprintf warning on overlapping output

2016-09-25 Thread Eric Gallager
On 9/25/16, Bernd Edlinger wrote: > Hi Martin, > > in the past I have seen (and fixed) code like > > sprintf(buf, "%s %d", buf, x); > > that may possibly work by chance, but usually > produces undefined results. > > Do you see a way to enhance the warning for cases > where the output buffer overla

sprintf warning on overlapping output

2016-09-25 Thread Bernd Edlinger
Hi Martin, in the past I have seen (and fixed) code like sprintf(buf, "%s %d", buf, x); that may possibly work by chance, but usually produces undefined results. Do you see a way to enhance the warning for cases where the output buffer overlaps an input buffer? Thanks Bernd.