From 1d11c93b59e8c86bac6e33b93d52d2a9b4161ccb Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Fri, 17 Dec 2021 11:10:34 +0100 Subject: [PATCH] mx_proc: Reduce linebuf size to 64 and fix comment > pid + " (" comm + ") " + state + " " + pid + " \0" > 10 + 2 + 15 + 2 + 1 + 1 + 10 + 2 = 43 Found-by: Donald --- mx_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx_proc.c b/mx_proc.c index 4edc2b2a..fc7092c3 100644 --- a/mx_proc.c +++ b/mx_proc.c @@ -460,7 +460,7 @@ pid_t mx_proc_get_parent(pid_t pid) { FILE *statfile; pid_t parent; int n; - char linebuf[256]; // "2147483647 (max128chars) X 2147483647 " = 156 + char linebuf[64]; // "2147483647 (max15chars) X 2147483647 " = 43 if (pid == 0) // no need to try /proc/0/stat return -1;