]> git.droids-corp.org - dpdk.git/commit
eal/linux: fix illegal memory access in uevent handler
authorSteve Yang <stevex.yang@intel.com>
Wed, 23 Feb 2022 08:49:50 +0000 (08:49 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 27 Feb 2022 18:12:34 +0000 (19:12 +0100)
commit1a287fc9c95bd6245c119b20f07382cf4b8fefa4
treec79fd0ce9679816db33b79053dde37c24f644ce3
parent9699b09803b799ddc11abedffb17af059c992e9a
eal/linux: fix illegal memory access in uevent handler

'recv()' fills the 'buf', later 'strlcpy()' used to copy from this buffer.
But as coverity warns 'recv()' doesn't guarantee that 'buf' is
null-terminated, but 'strlcpy()' requires it.

Enlarge 'buf' size to 'EAL_UEV_MSG_LEN + 1' and ensure the last one can
be set to 0 when received buffer size is EAL_UEV_MSG_LEN.

CID 375864:  Memory - illegal accesses  (STRING_NULL)
Passing unterminated string "buf" to "dev_uev_parse", which expects
a null-terminated string.

Coverity issue: 375864
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/eal/linux/eal_dev.c