find: Don't allow negative GIDs to be passed to the -group option

This commit is contained in:
Tim Ledbetter 2023-08-29 12:39:04 +01:00 committed by Tim Flynn
parent 6d7a2f5cc9
commit bc50b629ee
Notes: sideshowbarker 2024-07-17 01:06:10 +09:00

View file

@ -205,7 +205,7 @@ public:
m_gid = gr->gr_gid;
} else {
// Attempt to parse it as decimal GID.
auto number = StringView { arg, strlen(arg) }.to_int();
auto number = StringView { arg, strlen(arg) }.to_uint<gid_t>();
if (!number.has_value())
fatal_error("Invalid group: \033[1m{}", arg);
m_gid = number.value();