From fb593fcaaff2fd56db2e64a4e64a540af1939804 Mon Sep 17 00:00:00 2001 From: Andrew Consroe Date: Tue, 3 Sep 2024 17:50:12 -0500 Subject: [PATCH] fix getpwuid_r error handling getpwuid_r returns the error directly, not -1. In a situation with no /etc/passwd for example, ret is ENOFILE (2) and so the branch is never taken, resulting in a runaway realloc loop Signed-off-by: Andrew Consroe --- src/libcrun/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcrun/utils.c b/src/libcrun/utils.c index 630ac49be..68958ec22 100644 --- a/src/libcrun/utils.c +++ b/src/libcrun/utils.c @@ -1488,7 +1488,7 @@ getsubidrange (uid_t id, int is_uid, uint32_t *from, uint32_t *len) return -1; } - if (ret < 0 && errno != ERANGE) + if (ret != ERANGE) return ret; buf_size *= 2;