Apart from being a bad idea in general, the return statement contained
in that macro in some cases leads to returning from functions without
properly cleaning up, thereby causing memory leaks.
Instead, just sanitize the value in 'ret' to not harm further calls of
snprintf() (as 'len' will eventually just become zero).
Cc: Arturo Borrero <arturo.borrero.glez@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
#define SNPRINTF_BUFFER_SIZE(ret, size, len, offset) \
if (ret < 0) \
- return ret; \
+ ret = 0; \
offset += ret; \
if (ret > len) \
ret = len; \