From 44e4312fe105f61b13b7db07e0678475bc0f7850 Mon Sep 17 00:00:00 2001 From: skosachiov Date: Thu, 30 May 2024 12:39:00 +0300 Subject: [PATCH] Increase buffer size for reading process groups --- src/library/process.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/library/process.c b/src/library/process.c index 7a297a58..07dd6da9 100644 --- a/src/library/process.c +++ b/src/library/process.c @@ -339,7 +339,8 @@ uid_t get_program_uid_from_pid(pid_t pid) attr_sets_entry_t *get_gid_set_from_pid(pid_t pid) { - char buf[128]; + const int buf_size = 8192; + char buf[buf_size]; int gid = -1; FILE *f; attr_sets_entry_t *set = init_standalone_set(INT); @@ -349,7 +350,7 @@ attr_sets_entry_t *get_gid_set_from_pid(pid_t pid) f = fopen(path, "rt"); if (f) { __fsetlocking(f, FSETLOCKING_BYCALLER); - while (fgets(buf, 128, f)) { + while (fgets(buf, buf_size, f)) { if (memcmp(buf, "Gid:", 4) == 0) { sscanf(buf, "Gid: %d ", &gid); append_int_attr_set(set, gid); @@ -359,7 +360,7 @@ attr_sets_entry_t *get_gid_set_from_pid(pid_t pid) char *data; int offset; - while (fgets(buf, 128, f)) { + while (fgets(buf, buf_size, f)) { if (memcmp(buf, "Groups:", 7) == 0) { data = buf + 7; while (sscanf(data," %d%n", &gid,