Why Is Escaping Data Considered So Magical?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Sun Jun 27 00:17:39 EDT 2010
In message <roy-854954.20435125062010 at news.panix.com>, Roy Smith wrote:
> I recently fixed a bug in some production code. The programmer was
> careful to use snprintf() to avoid buffer overflows. The only problem
> is, he wrote something along the lines of:
>
> snprintf(buf, strlen(foo), foo);
A long while ago I came up with this macro:
#define Descr(v) &v, sizeof v
making the correct version of the above become
snprintf(Descr(buf), foo);
More information about the Python-list
mailing list