As a malloc0 could fail, doing a strncpy without checking could
cause issues. Adding an assert should be good enough and in line
with other similar routines in the code.
Found with Coverity Fixes: CID#
1261402
assert_se(tlv_packet_read_string(m, &str, &length) >= 0);
p = malloc0(length + 1);
assert_se(tlv_packet_read_string(m, &str, &length) >= 0);
p = malloc0(length + 1);
strncpy(p, str, length);
assert_se(streq(p, TEST_LLDP_TYPE_SYSTEM_NAME) == 1);
strncpy(p, str, length);
assert_se(streq(p, TEST_LLDP_TYPE_SYSTEM_NAME) == 1);