In message <[email protected]>, 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);
--
http://mail.python.org/mailman/listinfo/python-list
