diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2016-02-06 19:05:10 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2016-02-07 08:23:46 -0500 |
commit | f95ba548a286b17c260cc168715a9d0d441b14a6 (patch) | |
tree | eebda5911c55241fbb6e60dab7d188ff40180885 /doio.c | |
parent | 9a28816aff195b1fd1ba9bcaa3db6eefd8ad70d4 (diff) | |
download | perl-f95ba548a286b17c260cc168715a9d0d441b14a6.tar.gz |
Check against negative uid/gid for fchown().
Coverity CID 135145: Argument cannot be negative (NEGATIVE_RETURNS)
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1824,8 +1824,18 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV **sp) int fd = PerlIO_fileno(IoIFP(GvIOn(gv))); APPLY_TAINT_PROPER(); if (fd < 0) { - SETERRNO(EBADF,RMS_IFI); + SETERRNO(EBADF,RMS_IFI); + tot--; +#if Uid_t_sign == 1 + } else if (val < 0) { + SETERRNO(EINVAL,LIB_INVARG); tot--; +#endif +#if Gid_t_sign == 1 + } else if (val2 < 0) { + SETERRNO(EINVAL,LIB_INVARG); + tot--; +#endif } else if (fchown(fd, val, val2)) tot--; #else |