summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-09-19 12:47:45 +0000
committer/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-09-19 12:47:45 +0000
commitdce17ab4526920f1930f1fee4245ea66c33093ec (patch)
tree2b879bf4821c1e3a4acd9dbadbd3cefe10f416a6
parent40c0ecf2e13302aa0fc82304305d656254cdf927 (diff)
[Patch] ulogd, fix snprintf returnorigin
The attached patch fixes the treatment of snprintf return. Eric Leblond <eric@inl.fr>
-rw-r--r--ulogd/extensions/ulogd_BASE.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ulogd/extensions/ulogd_BASE.c b/ulogd/extensions/ulogd_BASE.c
index 412dc89..61bad21 100644
--- a/ulogd/extensions/ulogd_BASE.c
+++ b/ulogd/extensions/ulogd_BASE.c
@@ -82,8 +82,12 @@ static ulog_iret_t *_interp_raw(ulog_interpreter_t *ip,
for (i = 0; i < pkt->mac_len; i++, p++) {
tmp = snprintf(ptr+len, siz-len, "%02x%s",
*p, i==pkt->mac_len-1 ? "":":");
- if (tmp > siz-len)
+ if (tmp < 0)
break;
+ if (tmp >= siz-len) {
+ buf[siz] = '\0';
+ break;
+ }
len += tmp;
}
ret[0].value.ptr = buf;