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