glib-aux: accept zero bytes for nm_utils_random_bytes()

As an edge case, also accept requesting zero bytes of
randomness.
This commit is contained in:
Thomas Haller 2022-08-01 11:01:30 +02:00
parent 3c349ee11b
commit 614e050b24
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -245,8 +245,10 @@ nm_utils_random_bytes(void *p, size_t n)
gboolean has_high_quality = TRUE;
guint8 *buf = p;
if (n == 0)
return TRUE;
g_return_val_if_fail(p, FALSE);
g_return_val_if_fail(n > 0, FALSE);
#if HAVE_GETRANDOM
{