NetworkManager/libnm-core/tests
Thomas Haller 3a66217cbb
libnm: don't compare invalid mac addresses as equal in nm_utils_hwaddr_matches()
By passing as length of the MAC addresses -1 for both arguments, one
could get through to compare empty strings, NULL, and addresses longer
than the maximum. Such addresses are not valid, and they should never
compare equal (not even to themselves).

This is a change in behavior of public API, but it never made sense to
claim two addresses are equal, when they are not even valid addresses.

Also, avoid undefined behavior with "NULL, -1, NULL, -1" arguments,
where we would call memcmp() with zero length and NULL arguments.
UBSan flags that too.

(cherry picked from commit 54a64edefc)
2020-05-14 13:42:57 +02:00
..
certs libnm/crypto: accept TPM2-wrapped PEM keys 2019-07-10 17:31:48 +02:00
meson.build license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
nm-core-tests-enum-types.c.template build: use template files for enum types' sources generation 2017-12-18 11:25:06 +01:00
nm-core-tests-enum-types.h.template build: use template files for enum types' sources generation 2017-12-18 11:25:06 +01:00
test-compare.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
test-crypto.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
test-general-enums.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
test-general.c libnm: don't compare invalid mac addresses as equal in nm_utils_hwaddr_matches() 2020-05-14 13:42:57 +02:00
test-keyfile.c all: use nm_clear_pointer() instead of g_clear_pointer() 2020-03-23 11:22:38 +01:00
test-secrets.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
test-setting.c nm-setting-bridge: add 'multicast-router' bridge option 2020-04-06 09:56:11 +02:00
test-settings-defaults.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00