f4404b
diff -up ./pgrep.c.ori ./pgrep.c
f4404b
--- ./pgrep.c.ori	2022-08-17 15:38:29.655530551 +0200
f4404b
+++ ./pgrep.c	2022-08-17 15:38:53.702661752 +0200
f4404b
@@ -204,8 +204,12 @@ static int strict_atol (const char *rest
f4404b
 
f4404b
 	for ( ; *str; ++str) {
f4404b
 		if (! isdigit (*str))
f4404b
-			return (0);
f4404b
+			return 0;
f4404b
+		if (res >= LONG_MAX / 10)
f4404b
+			return 0;
f4404b
 		res *= 10;
f4404b
+		if (res >= LONG_MAX - (*str - '0'))
f4404b
+			return 0;
f4404b
 		res += *str - '0';
f4404b
 	}
f4404b
 	*value = sign * res;
f4404b
@@ -280,7 +284,7 @@ static int conv_uid (const char *restric
f4404b
 		xwarnx(_("invalid user name: %s"), name);
f4404b
 		return 0;
f4404b
 	}
f4404b
-	e->num = (int) pwd->pw_uid;
f4404b
+	e->num = pwd->pw_uid;
f4404b
 	return 1;
f4404b
 }
f4404b
 
f4404b
@@ -297,7 +301,7 @@ static int conv_gid (const char *restric
f4404b
 		xwarnx(_("invalid group name: %s"), name);
f4404b
 		return 0;
f4404b
 	}
f4404b
-	e->num = (int) grp->gr_gid;
f4404b
+	e->num = grp->gr_gid;
f4404b
 	return 1;
f4404b
 }
f4404b
 
f4404b
diff -up ./proc/readproc.h.ori ./proc/readproc.h
f4404b
--- ./proc/readproc.h.ori	2018-05-19 00:04:15.218532055 +0200
f4404b
+++ ./proc/readproc.h	2022-08-17 15:38:53.702661752 +0200
f4404b
@@ -159,12 +159,12 @@ typedef struct proc_t {
f4404b
 	session,	// stat            session id
f4404b
 	nlwp,		// stat,status     number of threads, or 0 if no clue
f4404b
 	tgid,		// (special)       thread group ID, the POSIX PID (see also: tid)
f4404b
-	tty,		// stat            full device number of controlling terminal
f4404b
-	/* FIXME: int uids & gids should be uid_t or gid_t from pwd.h */
f4404b
-        euid, egid,     // stat(),status   effective
f4404b
-        ruid, rgid,     // status          real
f4404b
-        suid, sgid,     // status          saved
f4404b
-        fuid, fgid,     // status          fs (used for file access only)
f4404b
+	tty;		// stat            full device number of controlling terminal
f4404b
+    uid_t euid; gid_t egid; // stat(),status effective
f4404b
+    uid_t ruid; gid_t rgid; // status        real
f4404b
+    uid_t suid; gid_t sgid; // status        saved
f4404b
+    uid_t fuid; gid_t fgid; // status        fs (used for file access only)
f4404b
+    int
f4404b
 	tpgid,		// stat            terminal process group id
f4404b
 	exit_signal,	// stat            might not be SIGCHLD
f4404b
 	processor;      // stat            current (or most recent?) CPU