Neither a pid_t below 1 nor a negative fd could be valid in this context.
Proof of Concept:
$ newuidmap -1 1 1 1
newuidmap: Could not open proc directory for target
4294967295
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
if ( ('\0' == *pidstr)
|| ('\0' != *endptr)
|| (ERANGE == errno)
+ || (val < 1)
|| (/*@+longintegral@*/val != (pid_t)val)/*@=longintegral@*/) {
return 0;
}
if ( ('\0' == *pidfdstr)
|| ('\0' != *endptr)
|| (ERANGE == errno)
- || (/*@+longintegral@*/val != (pid_t)val)/*@=longintegral@*/) {
+ || (val < 0)
+ || (/*@+longintegral@*/val != (int)val)/*@=longintegral@*/) {
return -1;
}