If the snprintf_cb() printed 0 characters, no \0 exists in the buffer.
Also, in that case fprintf() is meant to print nothing, so we can just exit.
This patch addresses new cases of textual output by libnftnl with trash.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
int ret;
ret = snprintf_cb(buf, bufsiz, obj, type, flags);
- if (ret < 0)
+ if (ret <= 0)
goto out;
if (ret >= NFT_SNPRINTF_BUFSIZ) {
return -1;
ret = snprintf_cb(buf, bufsiz, obj, type, flags);
- if (ret < 0)
+ if (ret <= 0)
goto out;
}