]> git.ipfire.org Git - thirdparty/iproute2.git/commit
iplink: check for message truncation in iplink_get()
authorMichal Kubecek <mkubecek@suse.cz>
Fri, 1 Sep 2017 16:39:11 +0000 (18:39 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 1 Sep 2017 21:15:00 +0000 (14:15 -0700)
commit6599162b958ea5a43d729df4f30aad515db26ff4
tree43d1c58ccf0757769028cb7025b2b5bb38ae2275
parentbc4a57b87990b30c85fdf0efbc1f8f219466daf4
iplink: check for message truncation in iplink_get()

If message length exceeds maxlen argument of rtnl_talk(), it is truncated
to maxlen but unlike in the case of truncation to the length of local
buffer in rtnl_talk(), the caller doesn't get any indication of a problem.

In particular, iplink_get() passes the truncated message on and parsing it
results in various warnings and sometimes even a segfault (observed with
"ip link show dev ..." for a NIC with 125 VFs).

Handle message truncation in iplink_get() the same way as truncation in
rtnl_talk() would be handled: return an error.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
ip/iplink.c