summaryrefslogtreecommitdiffstats
path: root/lib/print.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-03-12 18:27:45 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-03-12 18:27:45 +0100
commita875d3fb4beda43cb54b5810565bafc16a568e5c (patch)
treea20a5bd0488625d01d89965ac8ca7e72fa4454a7 /lib/print.c
parent6dbdb4e2ab4f83d6eccba2283bd8bb4b3cbc447a (diff)
Fix possible truncated output in ipset output buffer handling
Omri Bahumi and Yoni Lavi discovered that due to the inproper handling of the ipset output buffer, the output may be truncated. So for example in an "ipset save" output, instead of 192.168.0.0/24, just 192.168.0.0 printed. If one use "ipset save" and then "ipset restore" to restore the sets, this may lead to wrong firewall rules at the end. The patch fixes the bug in the ipset code.
Diffstat (limited to 'lib/print.c')
-rw-r--r--lib/print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/print.c b/lib/print.c
index 7f42434..7dd229e 100644
--- a/lib/print.c
+++ b/lib/print.c
@@ -31,7 +31,7 @@
#define SNPRINTF_FAILURE(size, len, offset) \
do { \
if (size < 0 || (unsigned int) size >= len) \
- return size; \
+ return offset + size; \
offset += size; \
len -= size; \
} while (0)