]> granicus.if.org Git - ipset/commitdiff
Fix long time uncovered bug at adding string attributes to the netlink message
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 27 May 2011 18:52:06 +0000 (20:52 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 27 May 2011 18:52:06 +0000 (20:52 +0200)
Use the real string length instead of the maximum one when adding the
attribute.

lib/session.c

index 0e05f285e9b9646ab443bbc4f2381b123fe1d06e..c03ed5de88cb82b1e2b8b6921445bc2f67c19b0a 100644 (file)
@@ -1453,6 +1453,9 @@ rawdata2attr(struct ipset_session *session, struct nlmsghdr *nlh,
                return 1;
 
        switch (attr->type) {
+       case MNL_TYPE_NUL_STRING:
+               alen = strlen((const char *)d) + 1;
+               break;
        case MNL_TYPE_U32: {
                uint32_t value = htonl(*(const uint32_t *)d);