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