NetworkManager/shared
Thomas Haller be8be0f091 shared: fix crash in _NM_UTILS_STRING_TABLE_LOOKUP_DEFINE()
If you have a LIST with 7 elements, and you lookup a value that
is not in the (sorted) list and would lie before the first element,
the binary search will dig down to imin=0, imid=0, imax=0 and
strcmp will give positive cmp value (indicating that the searched
value is sorted before).

Then, we would do "imax = imid - 1;", which wrapped to G_MAXUINT,
and the following "if (G_UNLIKELY (imin > imax))" would not hit,
resulting in an out of bound access next.

The easy fix is to not used unsigned integers.

The binary search was adapted from nm_utils_array_find_binary_search()
and nm_utils_ptrarray_find_binary_search(), which already used signed
integers to avoid this problem.

Fixes: 17d9b852c8 ('shared: explicitly implement binary search in NM_UTILS_STRING_TABLE_LOOKUP_DEFINE*()')
2020-04-10 07:57:08 +02:00
..
c-list license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
c-rbtree license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
c-siphash license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
c-stdaux license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
n-acd license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
n-dhcp4 meson: merge branch 'inigomartinez/meson-license' 2020-03-28 12:45:19 +01:00
nm-glib-aux shared: fix crash in _NM_UTILS_STRING_TABLE_LOOKUP_DEFINE() 2020-04-10 07:57:08 +02:00
nm-keyfile all: use nm_clear_g_free() instead of g_clear_pointer() 2020-03-23 11:05:34 +01:00
nm-libnm-aux clients: in debug builds randomly use sync init of NMClient for testing 2019-12-10 09:17:17 +01:00
nm-libnm-core-aux all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-libnm-core-intern shared: expose size of nm_ethtool_data array in header 2020-03-06 09:49:32 +01:00
nm-std-aux license: relicense "shared/nm-std-aux/nm-dbus-compat.h" under LGPL-2.1+ 2020-01-14 16:54:43 +01:00
nm-udev-aux shared/udev: don't use GIOChannel to watch plain file descriptor 2020-01-13 15:46:04 +01:00
nm-utils nm-setting-bridge: add 'group-address' bridge option 2020-04-06 09:56:11 +02:00
systemd systemd: merge branch systemd into master 2020-04-08 09:08:49 +02:00
meson.build systemd: merge branch systemd into master 2020-04-08 09:08:49 +02:00
nm-default.h libnm: include "nm-libnm-utils.h" by default in libnm sources 2019-10-18 22:09:18 +02:00
nm-meta-setting.c libnm-core,cli: add VRF setting 2020-01-14 09:49:01 +01:00
nm-meta-setting.h libnm-core,cli: add VRF setting 2020-01-14 09:49:01 +01:00
nm-test-libnm-utils.h libnm/tests: extend nmtstc_client_new() to create other GObject types 2020-01-28 10:54:14 +01:00
nm-test-utils-impl.c libnm/tests: cleanup add_device_common() test helper 2020-01-28 10:54:14 +01:00
nm-version-macros.h.in release: bump version to 1.23.0 (development) 2019-11-29 15:46:22 +01:00