chiark / gitweb /
sd-dhcp: fix test of magic cookie
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 14 Sep 2014 20:06:37 +0000 (22:06 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 14 Sep 2014 20:47:21 +0000 (22:47 +0200)
The magic cookie is set in dhcp_message_init. Test the magic cookie
value intead of writing the last 3/4 of it directly.

Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735

src/libsystemd-network/test-dhcp-option.c

index 92c58e0d58e5edebbbe418a474845c5ea2eda3da..7a0fac8d338a2f19357f07f978c2520272b89e7a 100644 (file)
@@ -100,9 +100,9 @@ static void test_message_init(void)
         magic = (uint8_t*)&message->magic;
 
         assert_se(magic[0] == 99);
-        assert_se(magic[1] = 130);
-        assert_se(magic[2] = 83);
-        assert_se(magic[3] = 99);
+        assert_se(magic[1] == 130);
+        assert_se(magic[2] == 83);
+        assert_se(magic[3] == 99);
 
         assert_se(dhcp_option_parse(message, len, NULL, NULL) >= 0);
 }