net/sched: act_simple: fix parsing of TCA_DEF_DATA
authorDavide Caratti <dcaratti@redhat.com>
Fri, 8 Jun 2018 03:02:31 +0000 (05:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jun 2018 00:06:28 +0000 (08:06 +0800)
commit81d159444da5b4dc7fee9182b5f8596b84722789
treef6c07e1188643aa65bc4118aa30785d9319c319f
parent73c0eab8d2158ef08120e979ce96f4fd80bc4488
net/sched: act_simple: fix parsing of TCA_DEF_DATA

[ Upstream commit 8d499533e0bc02d44283dbdab03142b599b8ba16 ]

use nla_strlcpy() to avoid copying data beyond the length of TCA_DEF_DATA
netlink attribute, in case it is less than SIMP_MAX_DATA and it does not
end with '\0' character.

v2: fix errors in the commit message, thanks Hangbin Liu

Fixes: fa1b1cff3d06 ("net_cls_act: Make act_simple use of netlink policy.")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_simple.c