curl-library
RE: [PATCH] banning "unsafe" functions
From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Wed, 6 Mar 2013 19:14:45 +0100
Date: Wed, 6 Mar 2013 19:14:45 +0100
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...
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-06