mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 20:00:09 +01:00
test: fix wrong use of memcmp() in nmtst_platform_ip4_routes_equal()
And nmtst_platform_ip6_routes_equal(). As already indicated by the comment, using memcmp() doesn't really work here. It worked up to now, because the NMPlatformIP4Route structure has no padding at the end. If we would have a last 'guint8' member (as we will add later), initializing an arry of routes on the stack would not clear the bytes from the padding and the comparison using memcmp() would fail.
This commit is contained in:
parent
f167346534
commit
d8d0c481b8
1 changed files with 0 additions and 6 deletions
|
|
@ -832,9 +832,6 @@ nmtst_platform_ip4_routes_equal (const NMPlatformIP4Route *a, const NMPlatformIP
|
|||
nmtst_static_1024_02 (nm_platform_ip4_route_to_string (&b[i])));
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* also check with memcmp, though this might fail for valid programs (due to field alignment) */
|
||||
g_assert_cmpint (memcmp (&a[i], &b[i], sizeof (a[i])), ==, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -867,9 +864,6 @@ nmtst_platform_ip6_routes_equal (const NMPlatformIP6Route *a, const NMPlatformIP
|
|||
nmtst_static_1024_02 (nm_platform_ip6_route_to_string (&b[i])));
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* also check with memcmp, though this might fail for valid programs (due to field alignment) */
|
||||
g_assert_cmpint (memcmp (&a[i], &b[i], sizeof (a[i])), ==, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue