From 3072eecf3c714e3ed88c882623c40aca15445f64 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 9 Dec 2014 01:09:21 +0100 Subject: sd-rtnl: fix size check in sd_rtnl_message_append_string() --- src/libsystemd/sd-rtnl/rtnl-message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsystemd') diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 5c627f96ab..165e84d7a0 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -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); -- cgit v1.2.3-54-g00ecf