]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-lldp: use `memcmp` to compare bytes (#8054)
authorEvgeny Vereshchagin <evvers@ya.ru>
Wed, 31 Jan 2018 08:54:37 +0000 (11:54 +0300)
committerLennart Poettering <lennart@poettering.net>
Wed, 31 Jan 2018 08:54:37 +0000 (09:54 +0100)
Technically, `data` is a sequence of bytes without a trailing zero,
so the use of `memcmp` seems to be logical here. Besides, this helps get
around a bug that makes `asan` report the false positive mentioned in
 #8052.

Closes #8052.

src/libsystemd-network/test-lldp.c

index b91797cb663dd356ba53bc4fd421a7740b2052c0..5f6829cf6d8a235923c3ed497fc3059b6be83d94 100644 (file)
@@ -139,7 +139,7 @@ static void test_receive_basic_packet(sd_event *e) {
         assert_se(sd_lldp_neighbor_get_port_id(neighbors[0], &type, &data, &length) == 0);
         assert_se(type == SD_LLDP_PORT_SUBTYPE_INTERFACE_NAME);
         assert_se(length == 3);
-        assert_se(strneq((char *) data, "1/3", 3));
+        assert_se(!memcmp(data, "1/3", 3));
 
         assert_se(sd_lldp_neighbor_get_port_description(neighbors[0], &str) == 0);
         assert_se(streq(str, "Port"));