Re: fixes for unlikely pointer overflow, buffer truncation

2024-08-05 Thread Paul Eggert
On 2024-08-05 16:13, Martin Dorey wrote: "Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no longer identical to _snprintf. The snprintf behavior is now C99 standard conformant. The difference is that if you run out of buffer, snprintf null-terminates the end of the b

Re: fixes for unlikely pointer overflow, buffer truncation

2024-08-05 Thread Martin Dorey
>> all systems providing correct >> sprintf() return values these days?  ISTR that some C runtime >> implementations didn't correctly return the formatted length. > 7th Edition Unix sprintf returned char * Perhaps the buffer is always big enough here. If not, though, then the more recent diffe

Re: fixes for unlikely pointer overflow, buffer truncation

2024-08-05 Thread Paul Eggert
On 2024-08-05 12:22, Paul Smith wrote: On Mon, 2024-08-05 at 01:59 -0700, Paul Eggert wrote: The first three patches are minor cleanups. Is it the case that we can rely on all systems providing correct sprintf() return values these days? ISTR that some C runtime implementations didn't correct

Re: fixes for unlikely pointer overflow, buffer truncation

2024-08-05 Thread Paul Smith
On Mon, 2024-08-05 at 01:59 -0700, Paul Eggert wrote: > The first three patches are minor cleanups. Is it the case that we can rely on all systems providing correct sprintf() return values these days? ISTR that some C runtime implementations didn't correctly return the formatted length. But mayb

fixes for unlikely pointer overflow, buffer truncation

2024-08-05 Thread Paul Eggert
While looking at GNU Make recently, I noticed an unlikely pointer overflow, and also a couple of undesirable buffer truncations in the W32 code. Proposed patches attached. The first three patches are minor cleanups. Patch 0004 fixes the pointer overflow, and patch 0005 fixes the truncations.