On 04/29/2016 11:54 AM, Ozkan Sezer wrote:
> On 4/29/16, lh_mouse <[email protected]> wrote:
>> snprintf() and _snprintf() are not equivalent.
>>
>> Given the following program:
>> ```
>> #include <stdio.h>
>>
>> int main(){
>>      char str[] = "0123456789";
>>      _snprintf(str, 5, "%s", "-----");
>>      puts(str);
>> }
>> ```
>> A standard-conforming program should write a null terminator at str[4],
>> truncating the output to "----".
>> The Microsoft _snprintf() follows the semantics of strncpy(). That is, it
>> does not operate null terminated strings, but 'string fields'.
>> It overwrites the first five characters without appending a null terminator
>> (which would cause an overflow apparently), effectively outputting
>> '-----56789'.
>>
>> ------------------                           
>> Best regards,
>> lh_mouse
>> 2016-04-29
>>
>
>
> Same goes for vsnprintf / _vsnprintf, which the defs he based his patch on
> seem have aliases for..
>
> --
> O.S.
>
>
>
>> -------------------------------------------------------------
>> 发件人:Hugo Beauzée-Luyssen <[email protected]>
>> 发送日期:2016-04-29 17:09
>> 收件人:mingw-w64-public
>> 抄送:
>> 主题:[Mingw-w64-public] [PATCH] crt: Add missing snprintf aliases
>>
>> ---
>>   mingw-w64-crt/lib32/msvcr120_app.def.in | 1 +
>>   mingw-w64-crt/lib64/msvcr120_app.def.in | 1 +
>>   2 files changed, 2 insertions(+)
>>
>> diff --git a/mingw-w64-crt/lib32/msvcr120_app.def.in
>> b/mingw-w64-crt/lib32/msvcr120_app.def.in
>> index 579edb3..bb1f214 100644
>> --- a/mingw-w64-crt/lib32/msvcr120_app.def.in
>> +++ b/mingw-w64-crt/lib32/msvcr120_app.def.in
>> @@ -1042,6 +1042,7 @@ _vscwprintf_p
>>   _vscwprintf_p_l
>>   _vsnprintf
>>   vsnprintf == _vsnprintf
>> +snprintf == _snprintf
>>   _vsnprintf_c
>>   _vsnprintf_c_l
>>   _vsnprintf_l
>> diff --git a/mingw-w64-crt/lib64/msvcr120_app.def.in
>> b/mingw-w64-crt/lib64/msvcr120_app.def.in
>> index 8c60b42..29aafba 100644
>> --- a/mingw-w64-crt/lib64/msvcr120_app.def.in
>> +++ b/mingw-w64-crt/lib64/msvcr120_app.def.in
>> @@ -984,6 +984,7 @@ _vscwprintf_p
>>   _vscwprintf_p_l
>>   _vsnprintf
>>   vsnprintf == _vsnprintf
>> +snprintf == _snprintf
>>   _vsnprintf_c
>>   _vsnprintf_c_l
>>   _vsnprintf_l
>> --
>> 2.8.1
>>
>>
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

That is a valid point.
The reason for the patch is that the crt headers expose a snprintf 
function, which fails to link with some runtime.
This leads, among other things, to some programs falling back to their 
own compat version or snprintf, which fails to build since there's 
already an existing (and slightly different) prototype somewhere else.
I'm open to suggestions as to how to fix this properly!

Regards,

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to