diff options
author | Thomas Haller <thaller@redhat.com> | 2020-04-09 10:52:32 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-04-10 10:27:27 +0200 |
commit | ef0c289104ebd013535a1bcfa9f476247b308bab (patch) | |
tree | be346ef2bd4eaa6120df74b92e034633e32fe5d6 /shared | |
parent | 1ef894f489ce0fc6e689c6671e50851763321f06 (diff) | |
download | NetworkManager-ef0c289104ebd013535a1bcfa9f476247b308bab.tar.gz |
shared/tests: avoid undefined behavior in test_nm_utils_get_next_realloc_size() test
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-glib-aux/tests/test-shared-general.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/nm-glib-aux/tests/test-shared-general.c b/shared/nm-glib-aux/tests/test-shared-general.c index 5cf3da143b..2c2aa3fcfd 100644 --- a/shared/nm-glib-aux/tests/test-shared-general.c +++ b/shared/nm-glib-aux/tests/test-shared-general.c @@ -659,7 +659,7 @@ test_nm_utils_get_next_realloc_size (void) break; case 3: /* values around powers of 2. */ - requested0 = (((gsize) 1) << (nmtst_get_rand_uint32 () % 64)) + 6000u - (nmtst_get_rand_uint32 () % 12000u); + requested0 = (((gsize) 1) << (nmtst_get_rand_uint32 () % (sizeof (gsize) * 8u))) + 6000u - (nmtst_get_rand_uint32 () % 12000u); break; case 4: /* values around 4k borders. */ |