From: Yu Watanabe Date: Sun, 15 Sep 2019 13:50:36 +0000 (+0900) Subject: sd-netlink: fix invalid assertion X-Git-Tag: v244~321^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48fb0d1301c78112360df943f2b6ebeb545b8510;p=platform%2Fupstream%2Fsystemd.git sd-netlink: fix invalid assertion It is natural that n_attiributes is less than type. But in that case, the message does not contain any message about the type. So, we should not abort execution with assertion, but just return -ENODATA. --- diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c index ddfb3ae..1696471 100644 --- a/src/libsystemd/sd-netlink/netlink-message.c +++ b/src/libsystemd/sd-netlink/netlink-message.c @@ -577,7 +577,9 @@ static int netlink_message_read_internal(sd_netlink_message *m, unsigned short t assert(m->n_containers < RTNL_CONTAINER_DEPTH); assert(m->containers[m->n_containers].attributes); - assert(type < m->containers[m->n_containers].n_attributes); + + if (type >= m->containers[m->n_containers].n_attributes) + return -ENODATA; attribute = &m->containers[m->n_containers].attributes[type];