cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: [PATCH] banning "unsafe" functions

From: Oscar Koeroo <okoeroo_at_nikhef.nl>
Date: Wed, 06 Mar 2013 19:33:50 +0100

Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch> schreef:

>
>Oscar Koeroo wrote:
>
>> count = snprintf(NULL, 0, "myformat");
>> buf = malloc(count);
>> snprintf(buf, count, "myformat");
>
>I would use:
>
>count = snprintf(NULL, 0, "myformat") + 1;
>
>to include nul-terminator...

I defend my obvious and stupid mistake by claiming this to me pseudo code and that I should not type this stuff in a hurry...
My bad\0

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-06