From: Yu Watanabe Date: Sun, 15 Sep 2019 13:50:36 +0000 (+0900) Subject: sd-netlink: fix invalid assertion X-Git-Tag: archive/raspbian/243-5+rpi1^2~55 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=be1ea1a56910e6113288016dafbd8a8f0fa2f257;p=systemd.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. (cherry picked from commit 48fb0d1301c78112360df943f2b6ebeb545b8510) (cherry picked from commit a321507476af07b9ce743608a15156f2bc43da1d) Gbp-Pq: Name sd-netlink-fix-invalid-assertion.patch --- diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c index ddfb3ae9..16964712 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];