chiark / gitweb /
sd-rtnl: fix size check in sd_rtnl_message_append_string()
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Dec 2014 00:09:21 +0000 (01:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Dec 2014 00:09:21 +0000 (01:09 +0100)
src/libsystemd/sd-rtnl/rtnl-message.c

index 5c627f9..165e84d 100644 (file)
@@ -700,8 +700,8 @@ int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const
                 size = (size_t)r;
 
         if (size) {
-                length = strnlen(data, size);
-                if (length >= size)
+                length = strnlen(data, size+1);
+                if (length > size)
                         return -EINVAL;
         } else
                 length = strlen(data);