Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
buf[sizeof(buf) - 1] = '\0';
tmp = strtol(buf, NULL, 10);
buf[sizeof(buf) - 1] = '\0';
tmp = strtol(buf, NULL, 10);
- if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) {
+ if (tmp == 0 || errno == ERANGE) {
PWRAP_LOG(PWRAP_LOG_ERROR,
"Failed to parse pid, buf=%s",
buf);
return;
}
PWRAP_LOG(PWRAP_LOG_ERROR,
"Failed to parse pid, buf=%s",
buf);
return;
}
- pid = (pid_t)(tmp & 0xFFFF);
+ pid = (pid_t)tmp;
+ /* Check if we are out of pid_t range on this system */
+ if ((long)pid != tmp) {
+ PWRAP_LOG(PWRAP_LOG_ERROR,
+ "pid out of range: %ld", tmp);
+ return;
+ }
rc = kill(pid, 0);
if (rc == -1) {
rc = kill(pid, 0);
if (rc == -1) {