summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-03-25 12:47:13 +0100
committerLuca Boccassi <luca.boccassi@microsoft.com>2021-03-25 13:02:43 +0100
commit7489d0640a4864d4b47fd8fda77f8eb7cf2e3fe8 (patch)
tree132d50da6351559a59dec0452a8904d7fc96a2cc
parenttest-firewall-util: add more asserts on allocated variables (diff)
downloadsystemd-7489d0640a4864d4b47fd8fda77f8eb7cf2e3fe8.tar.xz
systemd-7489d0640a4864d4b47fd8fda77f8eb7cf2e3fe8.zip
test-dhcp6-client: add one more assert on memory mapping
Static analyzers need a hint that optval is not pointing off the end of the msg_advertise array, since pos can go up to the full length of it. The array is manually constructed so we know this won't happen, but adding one more assert should be enough to avoid false positives. Coverity CID #1394277
-rw-r--r--src/libsystemd-network/test-dhcp6-client.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index cb363b3973..42cd91e0be 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -449,6 +449,7 @@ static int test_advertise_option(sd_event *e) {
case SD_DHCP6_OPTION_IA_NA:
assert_se(optlen == 94);
+ assert_se(optval == &msg_advertise[26]);
assert_se(!memcmp(optval, &msg_advertise[26], optlen));
val = htobe32(0x0ecfa37d);