1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

sd-lldp: use memcpy_safe() as the buffer size may be zero

(cherry picked from commit 87bd4b79e6)
This commit is contained in:
Yu Watanabe 2022-05-04 16:05:04 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 073eba2319
commit 5e069e405a

View File

@ -652,7 +652,8 @@ int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t ra
if (!n) if (!n)
return -ENOMEM; return -ENOMEM;
memcpy(LLDP_NEIGHBOR_RAW(n), raw, raw_size); memcpy_safe(LLDP_NEIGHBOR_RAW(n), raw, raw_size);
r = lldp_neighbor_parse(n); r = lldp_neighbor_parse(n);
if (r < 0) if (r < 0)
return r; return r;